I know Java keystore stores DER encoded certificate and SSL communication works perfectly fine with it, I wanted to check what happens with PEM encoded certificate so I converted my DER encoded certificate to PEM encoded using openssl
utility and then imported that PEM encoded SSL certificate into my keystore using keytool
utility and below are outcomes:
- PEM encoded certificate was successfully imported into my keystore and there was no exception.
- Then I tried SSL communication using
java.net.HttpURLConnection
and it was also successful and there were no exceptions.
So, this basically suggests me that this works but I am not sure what are implications of the same and whether this is recommended or not to use PEM encoded certificates in Java keystore. I am looking for answers which through insight on the implications, pros and cons of using PEM encoded certificate in Java keystore.
P.S.: If someone is looking for openssl
and keytool
command I used then please let me know and I can provide.
Please note that I have already read this and this, and these doesn't answer my questions.