Practical developer guides

PEM and DER certificates: parse without assuming trust

Distinguish certificate encoding from certificate validation and inspect validity dates, names and fingerprints.

Nav Tools ·

Identify the object and encoding

DER is a binary encoding used for ASN.1 structures. PEM-style textual encoding wraps Base64 data with a label indicating the object type.

A certificate label and a private-key label identify different objects. Converting representation does not turn one object type into the other.

-----BEGIN CERTIFICATE-----
<Base64-encoded DER certificate>
-----END CERTIFICATE-----

Inspect certificate fields

Parsing lets you inspect subject, issuer, validity interval, extensions and other fields. Check names in Subject Alternative Name for the expected host.

A parsed expiry date is useful evidence, but a correct date and name alone do not establish a trusted certificate chain.

Trust needs more validation

Certificate validation also involves signatures, a chain to a trusted root, policy and the application’s revocation approach. Parsing is not that verification process.

Nav Tools certificate decoder reports fields and does not validate trust chains. Use the real TLS or PKI verifier for a trust decision.

Compare the intended fingerprint

A fingerprint can hash certificate DER bytes; hashing the PEM text produces a different digest because wrapping and line breaks change bytes.

Confirm the algorithm and object used by the expected fingerprint. Avoid uploading private keys when only public certificate inspection is needed.

References

← Practical developer guides