我开发了两个简单的java程序:SSL客户端和SSL服务器,它们必须通过LAN进行通信,并进行单向身份验证。
现在我在同一台计算机上运行客户端和服务器。
我的问题是关于证书:
由于.jks
中的keytool,我设法创建了.crt
和jdk\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