Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Securing already connected java sockets with SSL?

Tags:

java

ssl

sockets

I have already connected sockets on server and client side and I want to know if it is possible to secure this connection with ssl in java somehow with SSLContext?

I know that client side sockets can be secured like this(with SSL). But i am not sure about connected sockets on server side?

Thanks for your help..

like image 749
Akdeniz Avatar asked May 26 '26 05:05

Akdeniz


1 Answers

Yes, it is possible on the server side. The SSLSocketFactory class has a createSocket() method just for this purpose. Once you return from the ServerSocket.accept() method you have a normal Socket that you can layer an SSLSocket on.

like image 90
President James K. Polk Avatar answered May 30 '26 04:05

President James K. Polk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!