Originally posted by patillaldi patillaldi:
I'm developing a web service who has to query other web services using a security certificates.
The remote web service calls are executed from different threads (simultaneous calls).
Which is the best way to implement security here?
When I access a single web service there is no problem. But when I try to access a second one I get the following:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA12275)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:224)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:157)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:114)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
This is the code I use to add the security certificates:
Web Service 1:
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', 'testkeystore.jks');
System.setProperty('javax.net.ssl.keyStorePassword','my_password');
System.setProperty('javax.net.ssl.trustStore','testtrustore.jks');
System.setProperty('javax.net.ssl.trustStorePassword','my_password');
Web Service 2:
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', 'mio.keystore');
System.setProperty('javax.net.ssl.keyStorePassword','password');
System.setProperty('javax.net.ssl.trustStore','mio.trustore');
System.setProperty('javax.net.ssl.trustStorePassword','password');
I think the problem comes when I try to put the second System property set, they overwrite the first one and then one of the threads ends up "distrusting" the remote certificate.
Is there any way to merge both key stores and both trust stores? If so, could you add some code?
Thanks in advance.
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|