1

I have developed two simple java programs : a SSL client and a SSL server which have to communicate on a LAN, with a one-way authentication.

Right now I am running the client and the server on the same computer.

My questions are about certificates :

I've managed to create a .jks and .crt thanks to the keytool in jdk\bin.

In server.java:

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

... and I don't know how import the certificate inside the client.

When I tried to run both this is what I got on the client side:

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

Jean
  • 1,179
  • 1
  • 14
  • 38
  • You probably have a self-signed certificate (or did you buy a certificate from a CA?). See, for example: [telling java to accept self-signed ssl certificate](http://stackoverflow.com/questions/2893819/telling-java-to-accept-self-signed-ssl-certificate) – Jesper Mar 13 '15 at 10:18
  • I created a self-signed certificate, then a keystore. Then I export this certificate from the keystore and added this certificate to the java CA (`jdk1.7.0_75\jre\lib\security\cacerts`) But it still won´t accept the connection – Jean Mar 13 '15 at 10:25
  • 1
    You import a certificate with the keytool. The error means you haven't. – user207421 Mar 13 '15 at 10:26
  • Ok, I must import the certificate in the cacerts in jdk1.7.0_75\jre\lib\security\cacerts, right ? – Jean Mar 13 '15 at 10:38

0 Answers0