Certificate Serial Numbers
Learn about X.509 certificate serial numbers — unique identifiers assigned by the CA. Understand their role in revocation, format requirements, and how to extract them from certificates.
Detailed Explanation
What Is a Certificate Serial Number?
The serial number is a unique integer assigned to each certificate by the issuing Certificate Authority (CA). Together with the issuer's Distinguished Name, the serial number forms a globally unique identifier for every certificate.
Where It Appears
Certificate:
Data:
Serial Number:
04:e3:b1:72:26:34:23:32:dc:f4:05:28:51:2a:ec:9c:6a
Serial numbers are displayed as hexadecimal values, often colon-separated. They can vary in length — RFC 5280 requires them to be positive integers of at most 20 octets (160 bits).
Role in Certificate Revocation
The serial number is the key identifier used in certificate revocation mechanisms:
CRL (Certificate Revocation List) — The CA publishes a signed list of revoked serial numbers. TLS clients download this list and check whether the server's certificate serial number appears on it.
# Example CRL entry
Serial Number: 04E3B17226342332DCF405285...
Revocation Date: Mar 15 12:00:00 2024 GMT
CRL Reason: keyCompromise
OCSP (Online Certificate Status Protocol) — The client sends the serial number to an OCSP responder, which replies with the revocation status of that specific certificate in real time.
Uniqueness Requirements
RFC 5280 requires that CAs assign unique serial numbers. In practice, CAs use different strategies:
- Sequential — simple incrementing counter (uncommon now due to predictability)
- Random — cryptographically random values (recommended by CA/Browser Forum)
- Hash-based — derived from certificate content hashes
The CA/Browser Forum Baseline Requirements mandate that serial numbers contain at least 64 bits of entropy from a CSPRNG (Cryptographically Secure Pseudo-Random Number Generator).
Extracting the Serial Number
# Print just the serial number
openssl x509 -in cert.pem -noout -serial
# Output: serial=04E3B17226342332DCF405285...
# Decimal format
openssl x509 -in cert.pem -noout -serial | sed 's/serial=//' | xargs printf "%d\n"
Serial Number Collisions
If a CA accidentally issues two different certificates with the same serial number, it creates serious problems:
- CRL entries become ambiguous — revoking one certificate may appear to revoke both
- OCSP responses cannot distinguish between the two
- Certificate Transparency log analysis becomes unreliable
The 2008 MD5 collision attack on RapidSSL exploited predictable serial numbers as part of the attack vector, which led the industry to mandate random serial numbers.
Use Case
Look up a certificate's serial number when checking revocation status via CRL or OCSP, reporting a compromised certificate to the CA for revocation, or correlating certificates across monitoring systems.