X.509 is the backbone of internet security. Every time you see the padlock icon in your browser, an X.509 certificate is working behind the scenes to authenticate the server and encrypt your connection. First defined by ITU-T in 1988 and continuously updated since, X.509 defines the format and semantics of public key certificates used throughout PKI (Public Key Infrastructure).
What Is an X.509 Certificate?
An X.509 certificate is a digitally signed data structure that binds a public key to an identity (person, server, organization, or device). It is issued by a trusted third party called a Certificate Authority (CA). The certificate proves: "This public key belongs to this entity, and a trusted CA vouches for it."
The X.509 Trust Chain
X.509 certificates form a chain of trust. Each certificate is signed by a higher-level certificate, all the way up to a self-signed Root CA that is pre-installed in your operating system or browser.
Certificate Chain Diagram
Self-signed · Pre-installed in OS/browser
Signed by Root · Issued to sub-CAs
Signed by Intermediate · For servers/users
X.509 v3 Extensions
Version 3 (RFC 5280) introduced extensions that dramatically expanded the certificate's capabilities. These extensions are the key reason modern X.509 is so versatile.
| Extension | OID | Purpose | Critical |
|---|---|---|---|
| Subject Alternative Name | 2.5.29.17 | Additional hostnames/IPs for the cert | Usually No |
| Key Usage | 2.5.29.15 | Permitted key operations (sign, encrypt, etc.) | Usually Yes |
| Extended Key Usage | 2.5.29.37 | Specific use cases (TLS, email, code signing) | No |
| Basic Constraints | 2.5.29.19 | Is this a CA? What is the path length? | Yes |
| CRL Distribution Points | 2.5.29.31 | Where to download the certificate revocation list | No |
| Authority Information Access | 1.3.6.1.5.5.7.1.1 | OCSP responder URL, issuer cert URL | No |
| Subject Key Identifier | 2.5.29.14 | Identifies the public key within the certificate | No |
Certificate Revocation: CRL vs. OCSP
When a certificate is compromised before it expires, it must be revoked. There are two main mechanisms:
📋 CRL (Certificate Revocation List)
A periodic, CA-signed list of revoked serial numbers. Downloaded by the client. Can be large and stale (updated every few hours or days). Simple but bandwidth-intensive.
Con: Can be outdated
⚡ OCSP (Online Certificate Status Protocol)
Real-time status check: the client sends the serial number to an OCSP responder and gets a signed "good", "revoked", or "unknown" response. OCSP Stapling bundles the response with the TLS handshake.
Con: Requires connectivity
Common X.509 Formats
| Format | Extension | Encoding | Usage |
|---|---|---|---|
| PEM | .pem, .crt, .cer | Base64 DER with header/footer | Linux, Apache, Nginx |
| DER | .der, .cer | Binary ASN.1 | Java, Android |
| PKCS#12 / PFX | .p12, .pfx | Encrypted bundle (cert + key) | Windows, IIS, .NET |
| PKCS#7 / P7B | .p7b, .p7c | Certificate chain (no private key) | Windows cert import |
Parsing X.509 Certificates in C#
using System.Security.Cryptography.X509Certificates;
// Load certificate from file
var cert = new X509Certificate2("certificate.pfx", "password");
// Access fields
Console.WriteLine($"Subject: {cert.Subject}");
Console.WriteLine($"Issuer: {cert.Issuer}");
Console.WriteLine($"Valid from: {cert.NotBefore}");
Console.WriteLine($"Valid until: {cert.NotAfter}");
Console.WriteLine($"Thumbprint: {cert.Thumbprint}");
Console.WriteLine($"Serial: {cert.SerialNumber}");
// Check Subject Alternative Names extension
var sanExt = cert.Extensions["2.5.29.17"];
if (sanExt != null)
{
var san = (X509SubjectAlternativeNameExtension)sanExt;
foreach (var dnsName in san.EnumerateDnsNames())
Console.WriteLine($"SAN DNS: {dnsName}");
}
// Validate the chain
var chain = new X509Chain();
chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
bool valid = chain.Build(cert);
Console.WriteLine($"Chain valid: {valid}");
Conclusion
X.509 is one of the most pervasive standards in computing, underpinning TLS/SSL, code signing, S/MIME email encryption, VPN authentication, smart card login, and much more. Understanding its structure — from the ASN.1 encoding to the extension model to the trust chain — is essential knowledge for any developer working with security, networking, or identity systems.