| Author |
Question about server trusted certificates
|
Sha Mont
Greenhorn
Joined: Aug 02, 2012
Posts: 5
|
|
I have a class that accesses a web service through HTTPS. This class will be used by a separate application. While developing the class I created JUnit test cases for testing. These test cases invoke a connection method in the class which connects to the web service.
The web service documentation indicates that the trusted certificate for the server should be imported into a java keystore at a specific location/directory as other tools will expect it to be there.
Since this is not what I think of as the standard place for certs, cacerts, I added the following code to my class to point to the appropriate location:
Properties systemProps = System.getProperties();
systemProps.put("javax.net.ssl.trustStore","C:/VMware-Certs/keystorename");
systemProps.put("javax.net.ssl.keyStore","C:/VMware-Certs/keystorename");
systemProps.put("javax.net.ssl.keyStorePassword",keystorepass);
systemProps.put("javax.net.ssl.keyStoreType","JKS");
System.setProperties(systemProps);
The JUnit test cases run flawlessly.
When I added the class to the application, I received an error about not being able to find the certificate.
I contacted the developer for the application that will use my class and they said that I needed to add the certificate to the cacerts keystore.
Now the application works as well.
My question is this. Why do I need to add the certificate to cacerts if my class code sets system properties so that the certificate can be found before attempting to connect? Does the application somehow override my code for the certificate?
While everything is working fine, I would like to understand how this works.
Thanks in advance
|
 |
Sha Mont
Greenhorn
Joined: Aug 02, 2012
Posts: 5
|
|
Wow, is there anyone here that can explain this to me?
Thanks
Sha Mont
|
 |
 |
|
|
subject: Question about server trusted certificates
|
|
|