How to Get SSL Cert File

Environment

Mac OS X 10.7.5

Solution 1: Use openssl

openssl s_client -connect [host]:[port] -showcerts /dev/null | openssl x509 -outform PEM > [output file]

Example:

openssl s_client -connect smtp.gmail.com:465 -showcerts /dev/null | openssl x509 -outform PEM > my.pem

Solution 2: Export from the web browser

Open firefox→Menu→選項(Options)→進階(Advance)→憑證(Certificates)→檢視憑證清單→選擇欲匯出的憑證→匯出(Export)

Open firefox→Connect to the HTTPS web site→click the “lock” icon→更多資訊→安全→檢視憑證→詳細資訊→匯出

The PEM file may look like this

-----BEGIN CERTIFICATE-----
MIIC7T...
.........
-----END CERTIFICATE-----

Reference

http://superuser.com/questions/97201/how-to-save-a-remote-server-ssl-certificate-locally-as-a-file

https://www.digicert.com/ssl-support/pem-ssl-creation.htm

https://www.novell.com/support/kb/doc.php?id=7013103

http://blog.icodejava.com/tag/get-public-key-of-ssl-certificate-in-java/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s