SSOGEN / Learn / What Is an X.509 Certificate?

Learn

What Is an X.509 Certificate?

An X.509 certificate is a signed record that binds a name to a public key. This page reads a real one, issued with OpenSSL, field by field.

A riveted metal data plate engraved CN=www.acme.example, EC P-256 and Not after 2031-11-16, with an embossed issuer seal
The CA signed the first 640 bytes, the tbsCertificate; the last 73 bytes hold the signature.

A .crt or .pem file holds one X.509 certificate. This one belongs to www.acme.example. A private test CA signed it with OpenSSL 3.5.8 on 2026-11-17. It is 729 bytes of binary data, or 1,042 bytes as the text below. Every value on this page comes from it.

A real certificate, field by field

The CA signed the first 640 bytes, the tbsCertificate. The last 73 bytes hold the signature. The rows below follow the order of RFC 5280 section 4.1 and then the extensions of section 4.2.

leaf.pem, decoded field by field
Version
3 (stored as 0x2)
Declares that extensions follow. RFC 5280 requires 3 when a certificate has extensions (4.1.2.1).
Serial number
4D:9B:2C:1E:7A:30:F5
Tells this certificate apart from every other one the issuer signed. At most 20 octets (4.1.2.2).
Signature algorithm
ecdsa-with-SHA256
Names how the CA signed. The same identifier must appear inside the signed body and outside it (4.1.2.3).
Issuer
C=US, O=Acme Example Inc, CN=Acme Example Issuing CA
Names the CA that signed.
Not before
2026-11-17 00:00:00Z
First moment the certificate is valid. The period includes both end dates (4.1.2.5).
Not after
2031-11-16 23:59:59Z
Last moment. Five years is this private test CA’s choice. Dates through 2049 use UTCTime, later ones GeneralizedTime.
Subject
C=US, O=Acme Example Inc, CN=www.acme.example
Names the holder of the key.
Public key
EC, P-256 (prime256v1), a 65-byte point
The key being certified. The matching private key stays on the server.
Basic constraints (critical)
CA:FALSE
This key may not sign other certificates (4.2.1.9).
Key usage (critical)
digitalSignature
Limits what the key may do (4.2.1.3).
Extended key usage
serverAuth, clientAuth
Lists the purposes. If the extension is present, the certificate may only be used for one of them (4.2.1.12).
Subject alternative name
DNS:www.acme.example, DNS:acme.example
The names the certificate answers for (4.2.1.6).
Subject key identifier
11:81:CC:D5:5D:86:74:05:85:AC:13:BC:E9:AA:AE:48:56:C9:75:48
A label for this key (4.2.1.2).
Authority key identifier
0B:61:DF:69:B3:52:99:0E:DD:B5:D5:94:49:FB:E0:C1:BF:45:06:47
A label for the signing key. It equals the CA certificate’s subject key identifier (4.2.1.1).
Authority information access
OCSP at http://ocsp.ca.acme.example; CA Issuers at http://pki.acme.example/issuing-ca.crt
Where to ask about status and where to fetch the issuer’s certificate (4.2.2.1).
CRL distribution points
http://crl.acme.example/issuing-ca.crl
Where the CA publishes revocations (4.2.1.13).
Signature value
70 bytes of ECDSA output
The CA’s signature over the tbsCertificate (4.1.1.3).

The SHA-256 fingerprint is not a field. It is a hash of all 729 bytes, so two files that differ by one bit have different fingerprints:

DC:2F:EA:4F:C7:41:E4:80:AF:E1:29:A1:06:CF:91:30:AC:B2:F3:B6:B1:B9:B8:33:B4:59:37:C5:9D:8B:87:DF

OpenSSL prints the two extensions that point outward with -ext:

openssl x509 -in leaf.pem -noout -ext authorityInfoAccess,crlDistributionPoints
Authority Information Access:
OCSP - URI:http://ocsp.ca.acme.example
CA Issuers - URI:http://pki.acme.example/issuing-ca.crt
X509v3 CRL Distribution Points:
Full Name:
URI:http://crl.acme.example/issuing-ca.crl
leaf.pem (1,042 bytes)
-----BEGIN CERTIFICATE-----
MIIC1TCCAnygAwIBAgIHTZssHnow9TAKBggqhkjOPQQDAjBKMQswCQYDVQQGEwJV
UzEZMBcGA1UECgwQQWNtZSBFeGFtcGxlIEluYzEgMB4GA1UEAwwXQWNtZSBFeGFt
cGxlIElzc3VpbmcgQ0EwHhcNMjYxMTE3MDAwMDAwWhcNMzExMTE2MjM1OTU5WjBD
MQswCQYDVQQGEwJVUzEZMBcGA1UECgwQQWNtZSBFeGFtcGxlIEluYzEZMBcGA1UE
AwwQd3d3LmFjbWUuZXhhbXBsZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABOUf
QFkKwfniLRQ0xgIudns3pnSOhtrZMre89qIW/BOaCvD0tBK8/vrRJriHZK4SiAm9
1H0NbyeYfSmIDSfcuryjggFSMIIBTjAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE
AwIHgDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwKQYDVR0RBCIwIIIQ
d3d3LmFjbWUuZXhhbXBsZYIMYWNtZS5leGFtcGxlMB0GA1UdDgQWBBQRgczVXYZ0
BYWsE7zpqq5IVsl1SDAfBgNVHSMEGDAWgBQLYd9ps1KZDt211ZRJ++DBv0UGRzBr
BggrBgEFBQcBAQRfMF0wJwYIKwYBBQUHMAGGG2h0dHA6Ly9vY3NwLmNhLmFjbWUu
ZXhhbXBsZTAyBggrBgEFBQcwAoYmaHR0cDovL3BraS5hY21lLmV4YW1wbGUvaXNz
dWluZy1jYS5jcnQwNwYDVR0fBDAwLjAsoCqgKIYmaHR0cDovL2NybC5hY21lLmV4
YW1wbGUvaXNzdWluZy1jYS5jcmwwCgYIKoZIzj0EAwIDRwAwRAIgLnUOoPihOrAl
30ktkT+NjRtWHVazI6BBQGnnTkIGDSECIApyVJWlb+v63JrwhVCPGVwUU+9Az4qU
Wq5q7IMnfbgT
-----END CERTIFICATE-----

Paste it into the certificate decoder to see the same fields in your browser.

Four checks that decide whether a client accepts it

A client does not read the subject to find a hostname. It tests names, purpose and the CA flag, and each test is a field above.

Extension What the client checks What fails
Subject alternative name The hostname it dialed is in the list. RFC 9525 (2023, section 2) says the Common Name must not be used to identify a service. ftp.acme.example is not in the sample’s list, so the sample is wrong for it even though the subject names the same organization.
Key usage The key is allowed to do the operation, here a signature. A key limited to digitalSignature may not be used for key encipherment.
Extended key usage The purpose it needs is listed. RFC 5280 lets an application require a particular purpose. A client that needs clientAuth refuses a certificate that lists only serverAuth.
Basic constraints The certificate is a CA before its key is used to verify another certificate’s signature. With CA:FALSE, the sample’s key cannot vouch for any other certificate.

Chain and trust failures belong to the wider system in what is PKI. PKIX path building failed walks through them.

The same certificate in four files

All four formats carry the sample’s data. They differ in encoding, in what else fits, and in whether a private key can be inside.

Format Usual extensions Encoding Can hold
DER .der, .cer Binary ASN.1 One certificate
PEM .pem, .crt Base64 of the DER between BEGIN and END lines (RFC 7468) One or more certificates, and other labeled blocks
PKCS#7 .p7b A signed-data structure with no signer (RFC 2315, RFC 5652) Certificates and CRLs, no private key
PKCS#12 .p12, .pfx Binary, password-protected (RFC 7292) Private key and certificates
Convert between the four (OpenSSL 3.5.8)
openssl x509 -in leaf.pem -outform DER -out leaf.der
openssl x509 -in leaf.der -inform DER -out leaf.pem
openssl crl2pkcs7 -nocrl -certfile leaf-chain.pem -out chain.p7b
openssl pkcs12 -export -nokeys -in leaf-chain.pem -out chain.p12

The .p12 is the form Java tools read.

Reading a certificate from a file or a live server

A certificate holds only public data, so you can read it anywhere. Where you find it depends on its job.

  • On a server. A PEM or PKCS#12 file that the web server or gateway loads, usually next to a separate private key file.
  • In a Java program. A keystore holds a private key with its certificate. A truststore holds certificates only. The default truststore is the JDK cacerts file.
  • In an operating system. A trust store of CA certificates that browsers and other programs consult.

To read the certificate a live server presents, and print only its subject, dates and names:

Read the certificate a server sends
openssl s_client -connect www.acme.example:443 -servername www.acme.example </dev/null \
| openssl x509 -noout -subject -dates -ext subjectAltName

To read the same fields from many servers at once, the Nmap script ssl-cert prints the subject, names and validity dates of each server’s certificate, as shown in these Nmap commands.

Questions people ask

How can I obtain an X.509 certificate?

Ask a certificate authority for one. Generate a key pair, check the request, and send it to a CA. It signs a certificate after confirming you control the name. Issuance itself is covered in certificate authority.

What is a digital signature and a digital certificate?

A digital signature proves who signed data; a digital certificate is signed data that binds a name to a key. In the sample, the CA signed the first 640 bytes and stored the 70-byte result as the last field. Anyone holding the CA’s public key can check it.

Is X509 the same as SSL?

No. X.509 is the certificate format. SSL and its successor TLS are protocols that send a certificate during the handshake. An “SSL certificate” is an X.509 certificate used for TLS. The same format also appears in SAML signing and, in mutual TLS, on the client.

Where are X509 certificates stored?

In files, keystores and trust stores. A server keeps its certificate in a PEM or PKCS#12 file or a keystore, with its private key. Programs keep CA certificates in a trust store, such as the JDK’s cacerts. A certificate holds no secret, so copying it is safe. Guard the private key.

Sources, all read 2026-11-17: RFC 5280 (May 2008), sections 4.1 and 4.2; RFC 9525 (November 2023), section 2; RFC 7468 (April 2015), sections 5 and 8; RFC 2315 (March 1998); RFC 5652 (September 2009); RFC 7292 (July 2014). Values in the sample come from openssl x509 -text on the file above.

Updated