![](/img/trans.png)
[英]SSL Error : no suitable certificate found continuing without client authentication in java
[英]SSL no suitable certificate found
我知道這是常見的錯誤,並且這個問題有很多重復。 雖然他們是我還沒有真正找到真正的原因並解決我的問題,所以讓我們開始吧。
我正在使用 Kafka,在我的信任庫的服務器端,我有 4 個鏈。 每個鏈代表一個證書頒發機構。 每個鏈也作為捆綁包(Interm + Root cert)導入。 當然,每個代理都有自己的密鑰庫,並由 CA-1 簽名。
我的客戶有 CA-3 簽署的證書。 在我客戶的信任庫中,我可以列出我的經紀人上的相同鏈。
例子:
在客戶端的調試模式下,我可以找到:
check handshake state: unknown[13]
*** CertificateRequest
Cert Types: RSA, DSS, ECDSA
Supported Signature Algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA224withECDSA, SHA224withRSA, SHA224withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Cert Authorities:
<CN=CA-1>
<CN=CA-2>
<CN=CA-3>
.
.
.
*** ServerHelloDone
[read] MD5 and SHA1 hashes: len = 4
0000: 0E 00 00 00 ....
Warning: no suitable certificate found - continuing without client authentication
*** Certificate chain
<Empty>
***
.
.
.
kafka-producer-network-thread | console-producer, READ: TLSv1.2 Handshake, length = 3018
check handshake state: server_hello[2]
kafka-producer-network-thread | console-producer, fatal error: 10: Handshake message sequence violation, 2
javax.net.ssl.SSLProtocolException: Handshake message sequence violation, 2
%% Invalidated: [Session-4, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384]
kafka-producer-network-thread | console-producer, SEND TLSv1.2 ALERT: fatal, description = unexpected_message
Padded plaintext before ENCRYPTION: len = 80
現在,我不明白。 應用程序能夠找到受信任的代理證書(我不想放在開頭的日志),能夠在 CertificateRequest 中找出所有可用的 CA,但它仍然無法握手。
可以肯定的是-我獲得失敗客戶端的 Interm + Root 證書的方式是我下載了中間證書並從 Interm 中提取了 Root 證書。 制作了一個捆綁包,其中 interm 是第一個,root 是第二個,那個捆綁包我放在信任庫和密鑰庫中的一個別名下。
我知道這很可能是服務器信任錯誤,但我不知道如何糾正這個問題,因為證書確實存在,並且我以與其他正在工作的人相同的方式導入了這些證書包。
如果我做錯了什么,請糾正我,如果我做錯了什么,請糾正我。 我是 SSL 點頭,想學東西..謝謝!
在我的情況下,我認為在堆棧上的很多情況下是:
所以,如果我會這樣做:
$ keytool -list -keystore client.keystore.jks
我會發現這個:
primaryca, Jul 26, 2014, trustedCertEntry,
Certificate fingerprint (SHA1): <snip>
client, Jul 26, 2014, trustedCertEntry,
Certificate fingerprint (SHA1): <snip>
如您所見,客戶端證書的密鑰庫中沒有PrivateKeyEntry 。
所以我從頭開始。
# Creating client keystore
$ openssl pkcs12 -export -in client_certificate.crt -inkey client_certificate.key -certfile client_certificate.crt -out client.p12
$ keytool -importkeystore -srckeystore client.p12 -srcstoretype pkcs12 -destkeystore client.keystore.jks -deststoretype JKS
# add bundle (interm + root)
$ keytool -keystore client.keystore.jks -alias CArootbundle -import -file bundle.pem
現在,在列出密鑰庫之后:
CArootbundle, Jul 26, 2014, trustedCertEntry,
Certificate fingerprint (SHA1): <snip>
1, Jul 26, 2014, PrivateKeyEntry,
Certificate fingerprint (SHA1): <snip>
在我使用新創建的密鑰庫啟動我的應用程序后,一切都開始工作了:)
希望我幫助了某人!
干杯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.