Last active
April 28, 2018 12:23
-
-
Save dwallraff/9ce28b53dd89699d38718a6152df1f79 to your computer and use it in GitHub Desktop.
Get SSL cert from website, convert as needed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Use openssl to get the cert from a site | |
## Get the PEM cert | |
openssl s_client -showcerts -connect example.com:443 </dev/null 2> /dev/null | openssl x509 -outform PEM > cert.pem | |
## If the server is using SNI, you'll need to pass the hostname of the cert you want | |
# openssl s_client -showcerts -servername www.example.com -connect $WEBSITE:443 </dev/null 2> /dev/null | openssl x509 -outform PEM > cert.pem | |
## Get the DER cert | |
# openssl s_client -showcerts -connect example.com:443 </dev/null 2> /dev/null | openssl x509 -outform DER > cert.crt | |
## Convert as needed | |
## Convert from pkcs12 (IIS) | |
# openssl pkcs12 -in cert.pfx -out cert.pem -nodes | |
## Convert to pkcs12 | |
# openssl pkcs12 -export -out cert.pfx -inkey keyfile.key -in cert.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment