I develop an Java app that is accessing an ssl web service.
I use java 6 jax-ws with basic authentication for accesing this ws.
I configured my local machine (windows) to query this web service.
From certificates point of view I set 2 keystores : an client keystore that contains an 2 entries : one for my private key and one for my certificate , signed by an CA. The other keystore , the truststore , hold an entry for my app server (that guest the ws) .
This is a self signed certificate and, of course, my client is complaining about this. I found here a workaround for this error and I imported this certificate in my truststore. Now I can query the ws from my local machine.
On PreProduction machine (RHEL 5) I get the same error message "
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"
I tried to do the same thing. But when I run:
java InstallCert my_ip:ssl_port changeit
I get the following output
Loading KeyStore cacerts...
Opening connection to my_ip:ssl_port...
Starting SSL handshake...
Exception in thread "Main Thread" java.lang.NoClassDefFoundError: javax/crypto/SunJCE_b
at javax.crypto.KeyGenerator.a(DashoA13*..)
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:91)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:744)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:238)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:958)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1203)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1230)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1214)
at InstallCert.main(InstallCert.java:58)
Class javax.crypto.sunJCE_b there is an jce.jar from the jre/lib. What do you think?
Another question: my truststore that I get in windows (the one that contain the imported server certificate) is not portable?
The one that I used on windows, I can copy it on linux, isn't it?