Java:如何导入证书?

时间:2015-03-13 10:14:11

标签: java validation security ssl

我开发了两个简单的java程序:SSL客户端和SSL服务器,它们必须通过LAN进行通信,并进行单向身份验证。

现在我在同一台计算机上运行客户端和服务器。

我的问题是关于证书:

由于.jks中的keytool,我设法创建了.crtjdk\bin

server.java

myKeyStore.load(new FileInputStream(keyStoreName), keyStorePassword);

...而且我不知道如何在客户端内导入证书。

当我试图同时运行时,这是我在客户端获得的:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

...

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

...

Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

0 个答案:

没有答案