如何使用 Bouncy Castle 编辑 Java 中的密码套件列表 [英] How can I edit the list of cipher suite in Java using Bouncy Castle

查看:30
本文介绍了如何使用 Bouncy Castle 编辑 Java 中的密码套件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码列出了 Java SE 8 支持的密码套件:

The following code lists the supported cipher suites by Java SE 8:

import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Arrays;

import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
public class ListCiphers {

    public static void main(String[] args) throws UnknownHostException, IOException
    {
        SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory(); 
        String[] cipherSuites = factory.getSupportedCipherSuites();
        System.out.println(Arrays.toString(cipherSuites));

    } //end main
}

我想制作配置了一些特定密码套件列表的 SSL 客户端.我想使用的密码套件是标准化的,但 Jva SE 8 不支持.例如,这个密码在 firefox 中列出:

I want to make SSL client which is configured with some specific list of cipher suites. The cipher suites I want to use are standardized but not supported by Jva SE 8. For example, this cipher is listed in firefox:

ECDHE_ECDSA_WITH_AES_256_SHA

请帮助我以任何方式允许我在我的 SSL 客户端中编辑密码套件列表.充气城堡对此有帮助吗?如何?请一步一步给我清楚.另外,如果您知道我想要什么可以通过使用其他语言(例如 python)来实现,也请帮助我.

Please, help me with any way that allows me to edit the list of cipher suite in my SSL client. Does Bouncy Castle help in this? How? Please, give me clear step by step. Also if you knwo what I want can be achieved by using another language such as python, also please help me.

推荐答案

如何使用 Bouncy Castle 编辑 Java 中的密码套件列表

How can I edit the list of cipher suite in Java using Bouncy Castle

请参阅要为 SSL 套接字启用哪些密码套件? 并使用 SSLSocketFactoryEx.它是 Java 的 SSLSocketFactory

See Which Cipher Suites to enable for SSL Socket? and use SSLSocketFactoryEx. Its a drop-in replacement for Java's SSLSocketFactory

如果你不想使用 SSLSocketFactoryEx,那么就撕掉代码来找到密码套件的交集.

If you don't want to use SSLSocketFactoryEx, then rip the code to find the intersection of cipher suites.

它控制协议和密码套件.没有意外的惊喜,例如从 SSLSocketFactory.getInstance("TLS"); 获取 SSLv3 套接字.

It controls both protocols and cipher suites. There are no unexpected surprises, like getting a SSLv3 socket back from SSLSocketFactory.getInstance("TLS");.

没有什么是可配置的,所以用户不能在脚上开枪.它也为 TLS 1.3 做好了准备

Nothing is configurable, so the user cannot shoot themselves in the foot. It's also ready for TLS 1.3

这篇关于如何使用 Bouncy Castle 编辑 Java 中的密码套件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆