Wednesday, September 22, 2010

Commandline Retrieval of a Remote SSL Certificate

Recently I've had to manage a lot of Java Keystores using keytool. Here's a convenient command to retrieve a remote servers SSL certificate so that you can import it as a trusted cert.



openssl s_client -connect remote.server.net:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' >/path/to/certificate.pem

No comments:

Post a Comment