java 不下载证书的 ssl 握手

java ssl handshake without downloading the certificate

在 SSL 握手期间,从服务器下载证书的步骤 3 是可选的。

那么如果我已经和我的客户端分发了证书,我该如何跳过下载来提高性能呢?

请注意,我知道如何加载本地证书以及如何信任它。但是我不知道如何跳过下载过程,而且我在 java 文档中也没有找到任何有用的东西。

提前致谢。

编辑

我的问题不是关于使用不需要证书的密码套件。我还有一个证书,希望使用它的 public 密钥进行对称密钥交换。

My question is NOT about using a cipher suite which does not require a certificate. I still have a certificate and wish to use its public key for encryption.

我认为您忽略了证书在 TLS 中的作用。主要任务是提供身份验证,以保护连接免受中间人攻击(即声称自己是服务器的中间人)。

负载加密根本不是由证书完成的。它最多用于在基于 RSA 的密钥交换中交换加密密钥。但对于目前推荐的密钥交换(ECDHE 和 DHE),根本不需要证书。

这意味着仅将证书用于密钥交换而不用于身份验证是没有意义的,因此没有支持此功能的密码。

During an SSL handshake, the step 3, which is downloading the certificate from the server, is optional.

我不知道你从哪里得到步数,但发送服务器证书是强制性的,除非客户端在 ClientHello 消息中声明它将接受非身份验证密码套件,并且这个在 RFC 2246 中被特别描述为不安全。

So if I have distributed the certificate with my client, how can I skip the downloading to improve the performance?

你不能。

Note that I know how to load a local certificate and how to trust it. But I don't know how to skip the downloading process and I haven't found anything useful in the java document.

你当然没有找到。它不在那里。 Java 文档或 RFC 2246 中根本没有关于它的任何内容。你发明了这个要求。这并不意味着 Java JSSE 或 SSL 本身都支持它。它没有。

My question is NOT about using a cipher suite which does not require a certificate. I still have a certificate and wish to use its public key for symmetric key exchange.

SSL 不执行对称密钥交换。你又一次在谈论不存在的东西。如果您想了解 SSL,请阅读 RFC 2246。如果您想发明自己的 SSL,请随意,但不要称它为 SSL,也不要自欺欺人地说它会像 SSL 一样高效或安全,后者已有近25年的发展历程。不会的。