【发布时间】:2021-02-22 02:41:51
【问题描述】:
访问我们的服务器时出现以下错误..
javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure
I have a .p12 certificate..
当我在 Soap UI 中给出 ssl 证书和密码的路径时。它工作得很好..我想在 Java/Eclipse 中做到这一点
Followed the step 1, 2 and 4 to create keystore and import it..
placed mykeystore and mycertificate in C:\Program Files\Java\jdk1.8.0_261\jre\bin
while importing I am getting following message..
C:\Program Files\Java\jdk1.8.0_261\jre\bin>keytool -v -importkeystore -srckeystore mycertificate.p12 -srcstoretype PKCS12 -destkeystore mykeystore -deststoretype JKS
Importing keystore mycertificate.p12 to mykeystore...
Enter destination keystore password:
Re-enter new password:
Enter source keystore password:
Entry for alias fcs certificate successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
[Storing mykeystore]
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore mykeystore -destkeystore mykeystore -deststoretype pkcs12".
在 eclipse 配置文件中添加以下内容
-Djavax.net.ssl.trustStore="C:/Program Files/Java/jdk1.8.0_261/jre/lib/security/cacerts"
-Djavax.net.ssl.trustStorePassword=changeit
Restarted the eclipse and trying to run that but still getting handshake failure..
我的所有程序都正确吗?
启用调试时.. 出现以下错误
javax.net.ssl|ALL|01|main|2020-11-09 18:28:51.118 IST|null:-1|No X.509 cert selected for RSA
javax.net.ssl|WARNING|01|main|2020-11-09 18:28:51.118 IST|null:-1|Unavailable authentication scheme: rsa_pkcs1_sha512
javax.net.ssl|ALL|01|main|2020-11-09 18:28:51.118 IST|null:-1|No X.509 cert selected for EC
另外一个方法,我也试过了。
从浏览器导出的证书..
https://www.javasavvy.com/import-ssl-certificate-into-java-keystore/
仍然出现同样的错误。
【问题讨论】:
-
那么,您将证书导入
mykeystore,但mykeystore是否驻留在C:/Program Files/Java/jdk1.8.0_261/jre/lib/security/cacerts中? -
我已经导入了,但是如何检查 mykeystore 是否存在于 cacerts 中?