24 lines
940 B
Text
24 lines
940 B
Text
|
|
||
|
// Prepare TLS parameters. These have to applied to every TLS
|
||
|
// socket before the handshake is triggered.
|
||
|
SSLParameters params = ctx.getDefaultSSLParameters();
|
||
|
// Do not send an SSL-2.0-compatible Client Hello.
|
||
|
ArrayList<String> protocols = new ArrayList<String>(
|
||
|
Arrays.asList(params.getProtocols()));
|
||
|
protocols.remove("SSLv2Hello");
|
||
|
params.setProtocols(protocols.toArray(new String[protocols.size()]));
|
||
|
// Adjust the supported ciphers.
|
||
|
ArrayList<String> ciphers = new ArrayList<String>(
|
||
|
Arrays.asList(params.getCipherSuites()));
|
||
|
ciphers.retainAll(Arrays.asList(
|
||
|
"TLS_RSA_WITH_AES_128_CBC_SHA256",
|
||
|
"TLS_RSA_WITH_AES_256_CBC_SHA256",
|
||
|
"TLS_RSA_WITH_AES_256_CBC_SHA",
|
||
|
"TLS_RSA_WITH_AES_128_CBC_SHA",
|
||
|
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
|
||
|
"SSL_RSA_WITH_RC4_128_SHA1",
|
||
|
"SSL_RSA_WITH_RC4_128_MD5",
|
||
|
"TLS_EMPTY_RENEGOTIATION_INFO_SCSV"));
|
||
|
params.setCipherSuites(ciphers.toArray(new String[ciphers.size()]));
|
||
|
|