Link to home
Start Free TrialLog in
Avatar of desiboy1974
desiboy1974

asked on

using ssl in web services

can someone tell me what this error is..

faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.Valida
torException: PKIX path building failed: sun.security.provider.certpath.SunCertP
athBuilderException: unable to find valid certification path to requested target

I'm running axis on tomcat and and trying to invoke a web service using https...

Avatar of asood314
asood314

Avatar of Mick Barry
you need to add the relevent cert to tomcat keystore
Avatar of desiboy1974

ASKER

>>you need to add the relevent cert to tomcat keystore....

the web service is not on my server though..its on a third party's...and i have sent my public cer(client.cer) to them and they have imported it...so basically i have generated the client and server keystores on my tomcat server and sent the client.cer to them..

i am just running the client..i have specified this in my client code though....

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
    Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    System.setProperty("javax.net.ssl.keyStore", "C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\conf\\server.keystore");
    System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
    System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\conf\\client.keystore");
    System.setProperty("javax.net.ssl.trustStorePassword", "changeit");

Thanks





you mean to say that they havent imported the client.cer on their end?

Thanks
Objects, can you assist?

Thanks
See this URL

It may help a little

http://e-docs.bea.com/wls/docs81/webserv/security.html.

There is an example of once such invocation. Not sure if that will be helpful, Which i got it from this source

http://www.mail-archive.com/axis-user@xml.apache.org/msg26069.html
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes i have using these commands

echo Generating the Server KeyStore in file server.keystore
"C:\Program Files\Java\jre1.6.0_02\bin\keytool" -genkey -alias tomcat-sv -dname "CN=localhost, OU=X, O=Y, L=Z, S=XY, C=YZ" -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore


echo Exporting the certificate from keystore to an external file server.cer
"C:\Program Files\Java\jre1.6.0_02\bin\keytool" -export -alias tomcat-sv -storepass changeit -rfc -file server.cer -keystore server.keystore

echo Generating the Client KeyStore in file client.keystore
"C:\Program Files\Java\jre1.6.0_02\bin\keytool" -genkey -alias tomcat-cl -dname "CN=Client, OU=X, O=Y, L=Z, S=XY, C=YZ" -keyalg RSA -keypass changeit -storepass changeit -keystore client.keystore

echo Exporting the certificate from keystore to external file client.cer
"C:\Program Files\Java\jre1.6.0_02\bin\keytool" -export -alias tomcat-cl -storepass changeit -rfc -file client.cer -keystore client.keystore

echo Importing Client's certificate into Server's keystore
"C:\Program Files\Java\jre1.6.0_02\bin\keytool" -import -v -trustcacerts -alias tomcat -rfc -file server.cer -keystore client.keystore -keypass changeit -storepass changeit

echo Importing Server's certificate into Client's keystore
"C:\Program Files\Java\jre1.6.0_02\bin\keytool" -import -v -trustcacerts -alias tomcat -rfc -file client.cer -keystore server.keystore -keypass changeit -storepass changeit
Objects...does that look right?

Thanks
Objects, any advice on what could be wrong?

Thanks
my mistake..i imported it into the wrong keystore...:)
Objects, i have one question outstanding..i was wondering if you could help?..:)