You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Zhiyong Weng <Zh...@cryptologic.com> on 2008/09/09 15:22:12 UTC
how to detect a successful SSL handshaking
Hi,
I have a client-server application using SSL communication.
At the very begin, the client needs to send the server a plain text,
so-called "dispatch SSL" message, which is to tell the server that SSL
will be using in the subsequent messaging.
After that, the client needs to initiate SSL connection with server,
which I used sslFilter to implement.
Once SSL handshaked successfully, the client will instantly send the
subsequent message, so-called "start".
At this moment after server receives so-called "start", the server
responded to the client at the first time.
Here is my code: (im using mina 2.0.0 M1)
create a sslFilter;
session.getFilterChain().addFirst("sslFilter",sslFilter);
The above statement will initiate the SSl handshaking based on my
understanding.
if I put the following code,
thread.sleep(3000);
sendRequest("start");
Do i need force thread to sleep for few seconds to wait for handshaking
finish?
My question is how to detect a SSL handshaking event?
Thank you for any help.
John
Re: how to detect a successful SSL handshaking
Posted by Emmanuel Lecharny <el...@gmail.com>.
Zhiyong Weng wrote:
> Hi,
>
Hi,
> <snip>
> Do i need force thread to sleep for few seconds to wait for handshaking
> finish?
>
No. The handshake is synchronous. When the handshake is done, you are
using SSL.
>
>
> My question is how to detect a SSL handshaking event?
>
The startHandshake() method will return when the handshake is completed.
The best is simply to rely on the sun documentation :
http://java.sun.com/j2se/1.5.0/docs/api/javax/net/ssl/SSLSocket.html#startHandshake()
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org