liveBook · Manning

Openssl x509

As explained in Software Security for Developers

The openssl x509 command is an OpenSSL command-line utility for reading, inspecting, and manipulating X.509 certificates.

openssl x509 is an OpenSSL command-line utility for extracting, reading, and inspecting X.509 certificates. It filters a TLS connection's output to isolate a certificate, then displays certificate fields in human-readable form. section 8.1.2 section 8.1.3

Capture and inspect a website certificate

Save GitHub's certificate, then inspect its structure: echo | openssl s_client -servername github.com -connect github.com:443 2>/dev/null | openssl x509 > github-cert.pem; openssl x509 -in github-cert.pem -noout -text. The output includes the issuer, subject, validity period, public-key information, and extensions. section 8.1.2 section 8.1.3

echo | openssl s_client -servername github.com -connect
github.com:443 2>/dev/null | openssl x509 
> github-cert.pem

Shows the pipeline that obtains a certificate from a TLS connection and passes it to openssl x509. section 8.1.2

openssl x509 -in github-cert.pem -noout -text

Shows the concise command for printing a PEM certificate's fields. section 8.1.3

How Software Security for Developers covers it

How deep it goes
Displays certificate fields and extracts public keys, while treating remaining X.509 fields only briefly.
Examples
Uses a GitHub TLS connection, github-cert.pem, certificate text output, and an extracted elliptic-curve public key.
What you can do after
Evaluate/understand certificate identity, issuer, validity, extensions, and public-key representation from command-line output.
How it connects
Connects TLS, X.509 certificates, PEM encoding, public keys, certificate fields, and OpenSSL s_client and pkey.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.