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

How can I edit the list of cipher suite in Java using Bouncy Castle(如何使用 Bouncy Castle 编辑 Java 中的密码套件列表)
本文介绍了如何使用 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 中的密码套件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA(PBKDF2-HMAC-SHA256 for JAVA 的可靠实现)
Correct way to sign and verify signature using bouncycastle(使用 bouncycastle 签名和验证签名的正确方法)
Creating RSA Public Key From String(从字符串创建 RSA 公钥)
Why java.security.NoSuchProviderException No such provider: BC?(为什么 java.security.NoSuchProviderException 没有这样的提供者:BC?)
Generating X509 Certificate using Bouncy Castle Java(使用 Bouncy Castle Java 生成 X509 证书)
How can I get a PublicKey object from EC public key bytes?(如何从 EC 公钥字节中获取 PublicKey 对象?)