Java SSL/TLS with Anonymous Diffie Hellman

2019-02-26 01:50发布

问题:

I have a basic client/server application written in Java which uses plain Sockets for communication.

I'd like to prevent passive eavesdropping attacks against it and do the communication over TLS/SSL. I don't want the application user to get in the hassle of setting up certificates etc., I'd like to setup Sockets over SSL with Anonymous Diffie Hellman using AES encryption (TLS_DH_anon_WITH_AES_128_CBC_SHA mode).

However I can't find any suitable examples on net or any documentation as to how I'd setup the SSLContext or SSLSocketFactory to enable the mode I want. I'd appreciate a minimal example for this.

回答1:

You should set the cipher suite on the SSLSocket (or SSLEngine) using setEnabledCipherSuites.



标签: java ssl