are there some APIs in java that equals to OpenSSL APIs such as ssl_accept(),SSL_connect,ssl_read(),ssl_write() and so on ?
thanks.
are there some APIs in java that equals to OpenSSL APIs such as ssl_accept(),SSL_connect,ssl_read(),ssl_write() and so on ?
thanks.
Are you looking for javax.net.ssl.SSLSocket?
This is more or less the same answer as the one I posted to your other question.
If you turn a Socket into an SSLSocket using SSLSocketFactory.createSocket(Socket, String, int, boolean), you can still turn it into a server-side SSLSocket using SSLSocket.setUseClientMode(false), as long as you haven't started to read/write using the I/O streams of the SSLSocket (this would trigger the handshake at you can't change the mode after that).
Alternatively, you can use SSLEngine. To be honest, it tends to be harder to use. You may find examples in the SSL implementations of Simple, Grizzly and Jetty (in NIO mode).