What an X.509 certificate is
An X.509 certificate binds a public key to a name. It says, in effect: "this public key belongs to auth.example.com, and I, the issuer, vouch for that until this date." The issuer signs the statement with its own private key, so anyone who trusts the issuer can trust the binding.
Certificates secure every HTTPS connection, and they appear throughout identity systems: the TLS certificate of the sign-in page, the signing certificate in SAML metadata, the certificate that wraps a realm’s token signing key, and client certificates for mutual TLS.
The format is defined in RFC 5280. Certificates are encoded in DER, a binary form of ASN.1, and usually shared as PEM: the DER bytes in Base64 between BEGIN CERTIFICATE and END CERTIFICATE lines.
What is inside a certificate
| Field | What it holds | What to check |
|---|---|---|
| Version | Almost always 3, which allows extensions | Version 1 certificates have no extensions |
| Serial number | A number unique per issuer | Used in revocation lists and to identify a certificate |
| Signature algorithm | How the issuer signed, such as sha256WithRSAEncryption | SHA-1 and MD5 signatures are no longer trusted |
| Issuer | The distinguished name of the signer | Equal to the subject for self-signed certificates |
| Validity | notBefore and notAfter dates, in UTC | Expiry is the most common certificate outage |
| Subject | The distinguished name of the owner | Browsers ignore its CN for host name checks |
| Public key | Algorithm, size or curve, and the key | RSA under 2048 bits is too weak |
| Extensions | Names, usages, constraints, links to the issuer | Subject alternative names decide which hosts are covered |
Distinguished names
Subject and issuer are distinguished names: a list of attributes such as C (country), O (organization), OU (organizational unit) and CN (common name). The decoder shows them in the order they are stored, the same order openssl x509 -text uses.
The extensions that matter most
- Subject alternative names (SAN): the DNS names, IP addresses, URIs or emails the certificate covers. Browsers check host names only here.
- Basic constraints: whether the certificate belongs to a certificate authority (CA) that may sign other certificates, and how deep a chain below it may go.
- Key usage: what the key may do, such as digital signature, key encipherment or certificate signing.
- Extended key usage: the purposes, such as TLS server authentication (
serverAuth) or client authentication (clientAuth). - Subject and authority key identifiers: hashes that link a certificate to the key of the CA that signed it.
- CRL distribution points and authority information access: where to check revocation (CRL, OCSP) and where to fetch the issuer’s certificate.
What this decoder does and does not do
- It reads PEM certificates, a whole chain of them, or bare Base64 without the BEGIN and END lines.
- It decodes the fields above with a small DER parser written for this page, and names common object identifiers.
- It shows SHA-256 and SHA-1 fingerprints computed with Web Crypto, and extracts the public key as PEM.
- It warns about expiry, missing subject alternative names, short RSA keys, SHA-1 or MD5 signatures, and chains in the wrong order.
- It does not verify the signature, check revocation, or decide whether a certificate is trusted. Trust depends on the root store of the system doing the checking.
We checked the decoder against openssl x509 -text on certificates with RSA and EC keys and the usual extensions, and the fields and fingerprints matched.
How to decode a certificate
- Paste the certificate in PEM form, or just the Base64 text. A sample self-signed certificate for
auth.example.comis filled in to start with. - Read the validity notice at the top: valid, not yet valid, or expired, with the days left.
- Check the subject alternative names cover every host name you serve.
- Check the issuer, and for a chain, that each certificate’s issuer is the next one’s subject.
- Compare the SHA-256 fingerprint with the one you expect, if you are pinning or confirming a certificate.
# A live server's certificate
openssl s_client -connect auth.example.com:443 -servername auth.example.com </dev/null 2>/dev/null | openssl x509
# The whole chain the server sends
openssl s_client -connect auth.example.com:443 -servername auth.example.com -showcerts </dev/nullCertificates in Keycloak
Keycloak uses certificates in several places, and the decoder helps with each.
Realm keys
Every realm signing key has a certificate. Under Realm settings, Keys, the Certificate button shows it as Base64 without PEM lines. Paste that text straight into the decoder. These certificates are usually self-signed; applications trust the key by fetching it from the realm, not through a CA.
SAML metadata
SAML identity provider and service provider metadata carry signing and encryption certificates in X509Certificate elements, again as bare Base64. When a SAML integration fails with a signature error, decoding both sides’ certificates and comparing fingerprints quickly shows whether they changed.
The server’s TLS certificate
Keycloak can serve HTTPS itself with a PEM certificate and key (the https-certificate-file and https-certificate-key-file options), or sit behind a reverse proxy that terminates TLS. Either way, the certificate must cover the public host name users see, and should include the intermediate certificates in the chain.
Client certificates
With mutual TLS, clients present certificates. Keycloak can authenticate OAuth clients by certificate (the X509 Certificate client authenticator) and sign in users with the X.509 client certificate authenticator, matching certificate fields such as the subject or a SAN to the user.
Common certificate problems
| Symptom | Likely cause | What to look at |
|---|---|---|
| Browser says the name does not match | The host is not in the SAN extension | Subject alternative names |
| Works in browsers, fails in Java or curl | The server does not send the intermediate certificate | Paste the full chain; it should have more than one certificate |
| Sudden failures across many services | The certificate expired | Not after |
| SAML signature validation fails after a change | The other side rotated its signing certificate | Compare SHA-256 fingerprints |
| Client certificate rejected | Missing clientAuth usage or wrong issuer | Extended key usage and issuer |
| Old clients reject a new certificate | A newer key type or signature algorithm | Public key and signature algorithm |
Certificate lifetimes are getting shorter
Public TLS certificates have a maximum lifetime set by the CA/Browser Forum, and it keeps shrinking. The forum has voted to reduce it in steps over the next few years, to 47 days by 2029. In practice that means certificate renewal must be automated, for example with ACME, rather than done by hand once a year.
This does not apply to self-signed certificates such as Keycloak’s realm key certificates, or to certificates from a private CA, which follow your own policy.
Security notes
- A certificate is public. Pasting one here is safe; it contains no private key. Never paste a private key into a decoder.
- Decoding tells you what a certificate claims. Whether to believe it is a separate check, done by validating the chain to a trusted root.
- Prefer SHA-256 fingerprints for comparisons. SHA-1 fingerprints are shown because many tools still print them.
- Watch for unexpected CA flags. An end-entity certificate with
CA: yescould sign other certificates.
Best practices
- Automate renewal and monitor expiry dates, with alerts weeks ahead.
- Always serve the full chain: your certificate followed by the intermediates.
- List every host name in the SAN extension, including the bare domain if you serve it.
- Use RSA 2048 or larger, or ECDSA P-256, with SHA-256 signatures.
- Record the SHA-256 fingerprint of signing certificates you rely on, so you notice when they change.