Skip to content

Instantly share code, notes, and snippets.

@xen0bit
Last active August 31, 2020 21:08
Show Gist options
  • Save xen0bit/510a2b99db194403cfd2cc498e70d472 to your computer and use it in GitHub Desktop.
Save xen0bit/510a2b99db194403cfd2cc498e70d472 to your computer and use it in GitHub Desktop.
Openssl Bash Profile Functions
getcert() {
#Pull and parse certificate
echo "Q" | openssl s_client -showcerts -connect "$1":443 | openssl x509 -text
}
getcertsans() {
#getcertsans example.com
echo "Q" | openssl s_client -showcerts -connect "$1":443 | openssl x509 -text | grep "DNS:" | sed -e 's/DNS://g' | sed -e 's/, /\n/g' | sed -e 's/ //g'
}
parsecsr() {
openssl req -in "$1" -noout -text
}
parsecert() {
openssl x509 -in "$1" -text -noout
}
pfx2pem() {
openssl pkcs12 -in "$1" -out "$1".pem -nodes
}
der2pem() {
openssl x509 -inform der -in "$1" -out "$1".pem
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment