views:

44

answers:

1

The most commonly used 'C' Implementation of SSL (OpenSSL) doesn't support parallely operations on it's SSL Session. (i.e. You cannot do a SSL_read & SSL_write) parallely for the same session.

Does the Java bases SSL, JSSE support this feature? i.e. For the same SSL Session created using JSSE, can I do read and write parallely on different threads? If yes, does it also handle renegotiation seamlessly (i.e. if a renegotiation request is received from the other side, will it be handled?)

Since, I have very little or no idea of Java, I have another very basic question also, Is it possible to do read / write parallely from different threads for the same socket in Java?

+2  A: 

Yes, SSLSockets and Sockets can be read and written by separate threads; yes an SSLSocket handles renegotiation seamlessly.

Your use of 'session' isn't quite right. You can have multiple SSLSockets (and openSSL sockets) per SSL session. In Java they can all be used independently.

EJP
@EJP, Thanks for your answer. Can you please elaborate more? As far as I know, One OpenSSL "SSL_S *" object cannot be shared by multiple threads without application using a mutex to protect it. But, in Java can this be achieved without an application acquiring a mutex? Is this done internally by Java? Does Java use OpenSSL underneath?
Jay
I've answered it. You can use multiple threads. No semaphores or mutexes or synchronization required. Java does not use OpenSSL under the hood.
EJP
@EJP, Thanks, But, now since I have been learning SSL for quite some time now, I wonder in case of renegotiation initiation by peer, how does the Java implementation handle it? There is a possibility in case of seamless renegotiation handling that your 'read' might do a 'write' and 'write' might do a 'read' internally. How is this handled? Any idea? Also, I didn't get your point about "multiple OpenSSL Sockets per Session". What exactly do you mean by a session?
Jay
It works. Try it. Never worried about this in 13 years. An SSL session is a tuple containing the negotiated protocol, the cipher suite, and the current session key. It can be shared among multiple SSLSockets, as I said above.
EJP