0

I am trying to call a SOAP webservice which is secured by SSL. They have provided me with a .p12 file.

I have extracted the privateKey.pem and publicCertificate.pem and keystore.jks.

  • Which of these files I really need to call the SOAP web service and why?
  • How should I use them? System.setProperty?
  • Do you advice me to store them in the application or in the host machine somewhere?

1 Answers1

0

if i get it right you are trying to call a soap service that is secured by ssl? If the service is secured by a certificate provided from an official trustcenter than there is nothing you have to do. (Maybe keep your java up to date in case of new root certificates)

If the service is secured by a self signed certificate then you have to provide the public key to the javavm to accept this certificate as trusted. You could add the Zertifikat to the java keystore file located in “C:\Program Files\Java\jre1.8.0_121\lib\security\cacerts” (depends on your operating system).

There is a very nice description for that here: telling java to accept self-signed ssl certificate

Community
  • 1
  • 1
uti.devel
  • 111
  • 1
  • 13
  • Yes exactly, web service secured by SSL, I edited the question. – The Strong Programmer Apr 05 '17 at 12:32
  • I am very confused since I have a jdk, a jre and they both have /bin and /lib. Is it certain that it checks this exact file cacerts in the path you specified? How can I check what file it checks for SSL keys? – The Strong Programmer Apr 05 '17 at 12:54
  • if you call Java from anywhere it's usually the jre. So it uses the jre cacerts. If you explicitly call the Java from the jdk the jdk keystore is used. To be sure you can specify which to use -Djavax.net.ssl.keyStore=pathtokeystore -Djavax.net.ssl.trustStore=pathtokeystore. Be aware that you have to add the certificate after every jre/jdk update. – uti.devel Apr 05 '17 at 13:02