开发者

are there some api in java equals to openSSL?

开发者 https://www.devze.com 2023-03-17 10:01 出处:网络
are there some APIs in java that equals to 开发者_StackOverflowOpenSSL APIs such asssl_accept(),SSL_connect,ssl_read(),ssl_write() and so on ?

are there some APIs in java that equals to 开发者_StackOverflowOpenSSL APIs such as ssl_accept(),SSL_connect,ssl_read(),ssl_write() and so on ?

thanks.


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).


Are you looking for javax.net.ssl.SSLSocket?

0

精彩评论

暂无评论...
验证码 换一张
取 消