In these cases you need to use keytool to import this certificate.
Steps to perform:
- Invoke the URL using your browser and save the certs of all levels in DER format
- Save all these DER files somewhere
- Invoke keytool: keytool -importcert -alias <myalias> -file <path to my file>.der
Now if you're working for a big company your whole development environment is well defined and most likely the Java version to use compiling your projects are also centrally controlled and you're not using the one that is installed on your workstation or laptop. What I've discovered that keytool doesn't really give a damn about your JAVA_HOME or path settings. Meaning it will choose a key store on your machine using a mysterious algorithm (aka. random) and it will never be the one you expect...
So you have to know where your key store is actually located. And that is your JAVA_HOME/jre/lib/security/cacerts file.
So in order to make keytool use the right key store the above mentioned command has to be altered accordingly:
keytool -importcert -alias <myalias> -file <path to my file>.der -keystore <JAVA_HOME>/jre/lib/security/cacerts
So now using the java under your JAVA_HOME will not cause any javax.net.ssl.SSLHandshakeException end you can live happily ever after!
No comments:
Post a Comment