Java 警告:找不到合适的证书-在没有客户端身份验证的情况下继续
我的团队在尝试使用HTTPS完成相互握手时面临以下问题Java 警告:找不到合适的证书-在没有客户端身份验证的情况下继续,java,ssl,mutual-authentication,Java,Ssl,Mutual Authentication,我的团队在尝试使用HTTPS完成相互握手时面临以下问题 main, READ: TLSv1.2 Handshake, length = 30 *** CertificateRequest Cert Types: RSA, DSS, ECDSA Supported Signature Algorithms: SHA1withRSA, SHA1withDSA, SHA1withECDSA, SHA256withRSA, Unknown (hash:0x4, signature:0x2), SHA25
main, READ: TLSv1.2 Handshake, length = 30
*** CertificateRequest
Cert Types: RSA, DSS, ECDSA
Supported Signature Algorithms: SHA1withRSA, SHA1withDSA, SHA1withECDSA, SHA256withRSA, Unknown (hash:0x4, signature:0x2), SHA256withECDSA, SHA384withRSA, Unknown (hash:0x5, signature:0x2), SHA384withECDSA
Cert Authorities:
<Empty>
main, READ: TLSv1.2 Handshake, length = 4
*** ServerHelloDone
Warning: no suitable certificate found - continuing without client authentication
*** Certificate chain
<Empty>
我正在准备一个jar文件,并从UNIX box中测试它
使用以下命令
java-Djavax.net.debug=ssl-cp snsslclienttrustwithstorecc.jar cassandra.cass.ClientCustomSSL
我已经跟帖了
并完成了布鲁诺提到的所有步骤
我不确定我在这里错过了什么。任何帮助都将不胜感激
CertificateRequest
消息中提到的任何签名者直接或间接签名的证书这实际上是TLS 1.0规范和TLS 1.1/1.2的不同之处 特别是,增加了以下内容: 如果证书颁发机构列表为空,则客户端可以发送 任何具有适当ClientCertificateType的证书,除非 是一些与此相反的外部安排
因此,空证书授权仅意味着客户端可以自由地向服务器发送任何证书,服务器的内部规则可能接受也可能不接受这些证书。在我的情况下,问题是我在加载密钥存储时将
null
作为密码传递:
KeyStore keyStore = KeyStore.getInstance("PKCS12")
InputStream inputStream = new FileInputStream('/path/to/mykeystore.p12')
try {
keyStore.load(inputStream, null); // <-- PROBLEM HERE!
}
finally {
inputStream.close();
}
我也有类似的问题 服务器Hellodone
警告:找不到合适的证书-在没有客户端身份验证的情况下继续 证书链
对我来说,问题是我错误地创建了密钥库:
keytool -importcert -keystore keystore.jks -alias client-cert -file client-cert.pem -storepass password
帮助我的是:
openssl pkcs12 -export -chain -in client-cert.pem -inkey client-key.pem -out keystore.p12 -name client-cert -CAfile ca-cert.pem
keytool -importkeystore -destkeystore keystore.jks -srckeystore keystore.p12 -alias client-cert
我在这里找到了这个解决方案:
伙计们,我怀疑SSLContext SSLContext=SSLContexts.custom().loadKeyMaterial(clientKeyStore,“Hello1.ToCharray()).loadTrustMaterial(clientTrustStore,(TrustStrategy)new TrustSelSignedStrategy()).build();CloseableHttpClient httpclient=HttpClients.custom().setSSLContext(sslContext.build();未添加ClientTrustStore中的所有证书。有人遇到过这样的问题吗?我前一天也遇到过同样的问题,我处理fallow:debug并观察了那些类:ClientHandshaker.serverHelloDone(),你会找到原因的!祝你好运!我不明白你的建议邱鸿霖 但我也被困在这个问题上了。(Java 7,TLS 1.2)@P.K您找到解决方案了吗?如果pkcs12文件没有设置密码,甚至需要添加一个空字节[]。
keytool -importcert -keystore keystore.jks -alias client-cert -file client-cert.pem -storepass password
openssl pkcs12 -export -chain -in client-cert.pem -inkey client-key.pem -out keystore.p12 -name client-cert -CAfile ca-cert.pem
keytool -importkeystore -destkeystore keystore.jks -srckeystore keystore.p12 -alias client-cert