Grabbing a Certificate with OpenSSL and importing it into Java

| certificate | java | openssl

Occasionally I have to grab a SSL cert from a server, and turn it into something that Java can use. Here are the quick instructions

# Store the cert issued by a web server
openssl s_client -showcerts -connect >

# Convert it from PEM format to DER format
openssl x509 -in -inform PEM -out -outform DER

# Import it into your keystore
sudo /usr/java6/bin/keytool -import -alias -file -keystore /usr/java6/jre/lib/security/cacerts

# The keystore password is by default "changeit"
comments powered by Disqus