Skip to content

Instantly share code, notes, and snippets.

@ipernet
Created March 9, 2017 23:22
Show Gist options
  • Save ipernet/c3e37825b43bda6cea9b79968d2e1bec to your computer and use it in GitHub Desktop.
Save ipernet/c3e37825b43bda6cea9b79968d2e1bec to your computer and use it in GitHub Desktop.
OpenSSL commands

CRT to DER:

openssl x509 -outform der -in auth.crt -out auth.der

DER to CRT:

openssl x509 -outform der -in certificate.pem -out certificate.der

Read DER:

openssl x509 -in auth.der -inform der -text -noout

Digest 256 DER:

openssl dgst -sha256 auth.der

Digest 256 CRT:

openssl x509 -noout -fingerprint -sha256 -inform pem -in auth.crt

Extract PUB key from CRT

openssl x509 -inform pem -in auth.crt -pubkey -noout > auth.pub

Extract PUB from KEY:

openssl rsa -in auth.key -pubout > auth.pub

PUB to DER:

openssl rsa -pubin -in auth.pub -pubout -outform DER > auth.pub.der

PKCS12 export pubkey (export with a pass < 32char):

openssl pkcs12 -in ccertificate.p12 -clcerts -nokeys -out pub.pem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment