Openssl extract website ssl certificate
Openssl extract website ssl certificate
Sometimes you need the actual certificate from a live site — for importing into a truststore, inspecting the details, or distributing to clients. The sed pipe extracts just the certificate block from the noisy s_client output. Save this one, you’ll use it more than you think.
- extract and save certificate to a file
1
$ echo | openssl s_client -showcerts -connect google.com:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/cert.crt
This post is licensed under
CC BY 4.0
by the author.