我已经用JDK 1.6编写了代码
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
SSLParameters params = context.getSupportedSSLParameters();
List<String> enabledCiphers = new ArrayList<String>();
for (String cipher : params.getCipherSuites()) {
boolean exclude = false;
if (exludedCipherSuites != null) {
for (int i = 0; i < exludedCipherSuites.length && !exclude; i++) {
exclude = cipher.indexOf(exludedCipherSuites[i]) >= 0;
}
}
if (!exclude) {
enabledCiphers.add(cipher);
}
}
String[] cArray = new String[enabledCiphers.size()];
SSLSocketFactory sf = context.getSocketFactory();
sf = new DOSSLSocketFactory(sf, cArray);
urlConnection.setSSLSocketFactory(sf);问题是,在JDK1.5中,我没有SSLParameters。如何在JDK 1.5中解决这个问题?
发布于 2015-03-02 18:20:32
假设您需要受支持的密码套件,您可以使用SSLSocketFactory.getSupportedCipherSuites()。参见that。
https://stackoverflow.com/questions/28806850
复制相似问题