首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何获取SSLParameters JDK1.5

如何获取SSLParameters JDK1.5
EN

Stack Overflow用户
提问于 2015-03-02 17:56:06
回答 1查看 377关注 0票数 0

我已经用JDK 1.6编写了代码

代码语言:javascript
复制
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中解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2015-03-02 18:20:32

假设您需要受支持的密码套件,您可以使用SSLSocketFactory.getSupportedCipherSuites()。参见that

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28806850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档