本文介绍了如何添加* .P12密钥库(有一个条目)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,我对证书普遍缺乏理解.我有一个.p12文件(带有未过期的证书)和一个有效的密码,因此我可以使用以下内容来list内容:

Apologies for my lack of understanding of certificates in general. I have a .p12 file (with a non-expired certificate) and a valid password so I can list the contents using:

keytool -list -keystore file.p12 -storepass password -storetype PKCS12 -v

在我的Java代码中,我正在尝试进行HTTPS发布,但始终收到此错误:

In my Java code I am attempting an HTTPS post but keep getting this error:

javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching [host.path.com] found

同一篇文章适用于我的其他环境之一,该环境不需要任何身份验证,并且链接是HTTP(相对于HTTPS).如何使此.p12文件能在握手中被识别?

This same post works against one of my other environments which does not have any authentication required and the link is HTTP (vs. HTTPS). How do I make this .p12 file work for it to be recognized in the handshake?

推荐答案

您可以使用以下命令

keytool -v -importkeystore -srckeystore alice.p12 -srcstoretype PKCS12 -destkeystore "c:\Program Files\Java\jre1.8.0_71\lib\security\cacerts"  -deststoretype JKS

您的证书的默认密码为 changeit

Default password for your cacerts will be changeit

其中信任库将是您的JRE信任库

Where trust store will be your JRE trust store

有关更多信息,请参阅此处 http://www.webfarmr.eu/2010/04/import-pkcs12-private-keys-into-jks-keystores-using-java-keytool/

Please refer here for more informationhttp://www.webfarmr.eu/2010/04/import-pkcs12-private-keys-into-jks-keystores-using-java-keytool/

这篇关于如何添加* .P12密钥库(有一个条目)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 15:47