Skip to content

Instantly share code, notes, and snippets.

@madsonic
Last active April 18, 2019 02:31
Show Gist options
  • Save madsonic/f381f178944c978feb0a046513034f50 to your computer and use it in GitHub Desktop.
Save madsonic/f381f178944c978feb0a046513034f50 to your computer and use it in GitHub Desktop.
commands for checking TLS certs
# CAfile trusts a given CA cert for this call
# should return 0
# Certificate chain is presented:
# Number on left represents depth
# example.com is the first subject i.e. the host we are contacting
# and its issuer is Fake LE Intermediate X1
# the next cert on the chain has its subject as Fake LE Intermediate X1
# and its issuer is Fake LE Root X1
# which is the root of the chain i.e. a Certificate Authority
#
# Certificate chain
# 0 s:/CN=example.com
# i:/CN=Fake LE Intermediate X1
# 1 s:/CN=Fake LE Intermediate X1
# i:/CN=Fake LE Root X1
openssl s_client [-CAfile <ca-file>] [-showcerts] -connect <host>:443
# reading certs
openssl x509 -in <file> -out -notext
# converting cert formats:
openssl x509 -in <file> -inform <der|pem|net> -outform <der|pem|net> -out <file>
# curling with a inline CA file
curl --cacert <certfile.pem> https://:host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment