服务器问候完成后TLS握手错误

时间:2020-05-10 12:30:18

标签: java ssl certificate tls1.2

我有一个python应用程序正在连接到Java应用程序,两者都使用相同的证书。该证书也导入到双方的受信任证书中。

使用自签名证书验证了整个TLS握手过程的功能。

但是,当我想使用全局CA签名的证书时,遇到握手错误:

这是我通过在服务器端(java应用)上启用-Djavax.net.debug=ssl,handshake所获得的SSL日志:

.
.
.
***
update handshake state: certificate[11]
upcoming handshake states: server_key_exchange[12](optional)
upcoming handshake states: certificate_request[13](optional)
upcoming handshake states: server_hello_done[14]
upcoming handshake states: client certificate[11](optional)
upcoming handshake states: client_key_exchange[16]
upcoming handshake states: certificate_verify[15](optional)
upcoming handshake states: client change_cipher_spec[-1]
upcoming handshake states: client finished[20]
upcoming handshake states: server change_cipher_spec[-1]
upcoming handshake states: server finished[20]
*** ECDH ServerKeyExchange
Signature Algorithm SHA256withRSA
Server key: Sun EC public key, 256 bits
  public x coord: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  public y coord: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)
update handshake state: server_key_exchange[12]
upcoming handshake states: certificate_request[13](optional)
upcoming handshake states: server_hello_done[14]
upcoming handshake states: client certificate[11](optional)
upcoming handshake states: client_key_exchange[16]
upcoming handshake states: certificate_verify[15](optional)
upcoming handshake states: client change_cipher_spec[-1]
upcoming handshake states: client finished[20]
upcoming handshake states: server change_cipher_spec[-1]
upcoming handshake states: server finished[20]
*** ServerHelloDone
update handshake state: server_hello_done[14]
upcoming handshake states: client certificate[11](optional)
upcoming handshake states: client_key_exchange[16]
upcoming handshake states: certificate_verify[15](optional)
upcoming handshake states: client change_cipher_spec[-1]
upcoming handshake states: client finished[20]
upcoming handshake states: server change_cipher_spec[-1]
upcoming handshake states: server finished[20]
Thread-54, WRITE: TLSv1.2 Handshake, length = 2075
Thread-54, READ: TLSv1.2 Alert, length = 2
Thread-54, RECV TLSv1.2 ALERT:  fatal, unknown_ca
%% Invalidated:  [Session-2, SSL_NULL_WITH_NULL_NULL]
%% Invalidated:  [Session-4, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384]
Thread-54, called closeSocket()
Thread-54, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca

最后一行 ServerHelloDone 指示错误:

Thread-54, WRITE: TLSv1.2 Handshake, length = 2075
Thread-54, READ: TLSv1.2 Alert, length = 2
Thread-54, RECV TLSv1.2 ALERT:  fatal, unknown_ca
%% Invalidated:  [Session-2, SSL_NULL_WITH_NULL_NULL]
%% Invalidated:  [Session-4, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384]
Thread-54, called closeSocket()
Thread-54, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca

下一步显然是 client_key_exchange 。它与客户端的私钥有任何关系吗?

unknown_ca是什么意思?客户端的trust_cert或服务器的证书中缺少证书吗?

下图也是使用Wireshark捕获的流量,主要线路使用自签名证书,最后3行用于问题证书,如上所述:

enter image description here

1 个答案:

答案 0 :(得分:1)

unknown_ca是什么意思?客户端的trust_cert或服务器的trust_cert中缺少证书吗?

unknown_ca表示由于信任存储中缺少CA,因此该证书不受信任。由于警报是由客户端发送的,这意味着客户端不信任颁发服务器证书的CA。这可能是因为信任存储中缺少根CA,但也可能是服务器没有发送必要的中间证书,因此客户端可以建立到本地根CA的信任链。