I'm working on an application that calls a third-party webservice over https. So I need to add this certificate to the truststore of my application. I can see 3 solutions to fix my problem:
$JAVA_HOME/jre/lib/security/cacerts
-Djavax.net.ssl.trustStore= ...
Which solution do you recommend/discourage me to use?
I found out that Java has it's own "certificate Store" which is located in a file in the security-folder inside the lib-folder. You could access this from the Java Control Panel -> Security -> Manage Certificates.
To configure your Java Runtime Environment to use SSL, follow these steps: Import a certificate from the database server to a Java truststore on the client. Use the Java keytool utility to import the certificate into the truststore. Example: Suppose that the server certificate is stored in a file named cacerts.
I'd prefer the second one. Because;
For the first one; when you change your java version you need to do extra work (you must add these ssl certs to cacerts again).
For the third one; when you need to add another ssl cert. you must change your code.
So, the second is the best choice because; you will not need to change your code when new ssl comes (You will just add it to external trustStore) and you will do nothing for these certs when you upgrade your java version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With