Teams that already run an X.509 PKI often ask why SSH needs its own certificate authority, and teams that have just built an SSH CA ask whether it could replace their TLS certificates; the honest answer is that the two formats solve different trust problems and rarely substitute for each other. An OpenSSH certificate is a flat, short-lived grant signed directly by a CA key that each server trusts by configuration. An X.509 certificate sits in a chain of CAs, carries names and constraints that general-purpose libraries validate, and has decades of revocation and transparency machinery around it. This guide compares the two as credentials for machine access: format, trust model, revocation, tooling and the operating model, ending with when to run separate CAs and when one PKI can feed both. It assumes you know what each is; for SSH CA operation read the SSH Protocol and Certificate Authority Guide, for the protocol comparison SSH vs TLS, and for keys against certificates SSH Keys vs SSH Certificates.
Key takeaways
- Different formats, not versions of one: the OpenSSH manual describes its certificates as "a different, and much simpler, format to the X.509 certificates used in ssl(8)", so tooling, parsers and policy engines for one do not read the other.
- Flat trust against chained trust: SSH servers trust CA public keys listed directly in configuration, while X.509 relies on path validation from a leaf through intermediates to a trusted root under RFC 5280 Section 6.
- Authorisation lives in the SSH certificate: principals, forced commands, source addresses and forwarding permissions are signed into an OpenSSH user certificate; X.509 carries identity and key usage, and authorisation sits in the relying application.
- Revocation is local for SSH, published for X.509: SSH relies on a Key Revocation List file each server reads through RevokedKeys, while X.509 publishes CRLs and, where still offered, OCSP; both models push towards short lifetimes.
- Run separate CAs by default: separate keys, separate signing policy and separate blast radius, joined by a shared identity source and a shared issuance workflow, is the pattern that holds up for most estates.
The short answer
Use OpenSSH certificates for SSH logins and host authentication to OpenSSH servers, because that is what OpenSSH natively validates and what lets you sign authorisation (which accounts, which commands, from where) into the credential. Use X.509 for TLS, mutual TLS between services, code signing, device identity and anywhere a library, browser or appliance expects a certificate chain. Consider X.509 for SSH only where you run an SSH implementation that supports RFC 6187 and a policy requirement forces one PKI, and accept that the OpenSSH server most estates use does not take that path. Platforms are described generically here; product names appear only to explain formats.
Side-by-side comparison
| Property | OpenSSH certificate | X.509 v3 certificate |
|---|---|---|
| Specification | OpenSSH project format; key types such as [email protected] | RFC 5280 profile (Proposed Standard, May 2008, updated by later RFCs) |
| Encoding | SSH wire format, one line in a -cert.pub file | ASN.1 DER, often PEM-wrapped |
| Identity fields | Key ID (logged by the server, usable for revocation) and a list of principals | Issuer and subject names, subjectAltName (DNS, IP, URI, email) |
| Validity | Valid after and valid before; without -V, valid from the Unix epoch to the distant future | notBefore and notAfter, always present |
| Serial | Serial number, defaults to zero unless set with -z | Positive integer, at most 20 octets |
| Hierarchy | None: the CA key is trusted directly | Root, intermediates, leaf; basicConstraints and pathLenConstraint |
| Scope limits | Principals list; host principals may use wildcards | nameConstraints on CA certificates, keyUsage and extendedKeyUsage |
| Authorisation content | Critical options (force-command, source-address, verify-required) and extensions (permit-pty, permit-port-forwarding and others) | Normally none; applications map identity to permissions |
| Revocation | KRL by serial, serial range, key ID, key or SHA256 fingerprint, distributed to each server | CRL (Section 5 of RFC 5280) and OCSP (RFC 6960) |
| Transparency | No public log | Certificate Transparency for publicly trusted TLS |
Format: what each certificate actually carries
OpenSSH certificates
An OpenSSH certificate binds a public key to a key ID, zero or more principals, a validity window, a serial and a set of options, all signed by a CA key. User certificates can carry critical options that the server must understand or refuse the certificate: force-command restricts the session to one command, source-address restricts client addresses in CIDR form, and verify-required demands user verification on FIDO keys. Extensions grant features (permit-agent-forwarding, permit-port-forwarding, permit-pty, permit-user-rc, permit-X11-forwarding); the -O clear option removes the defaults so you can grant only what is needed. Host certificates are created with -h and accept no standard options. ssh-keygen -L prints a certificate's contents, which is the first step in any review.
X.509 certificates
An X.509 v3 certificate carries version, serial number, signature algorithm, issuer, validity, subject, subject public key info and extensions. The extensions that matter for machine access are subjectAltName (4.2.1.6) for the names a relying party matches, keyUsage (4.2.1.3) and extendedKeyUsage (4.2.1.12) for what the key may do, basicConstraints (4.2.1.9) and nameConstraints (4.2.1.10) for what a CA may issue, and CRL distribution points (4.2.1.13) and Authority Information Access (4.2.2.1) for where to check status. SPIFFE's X.509-SVID specification shows how a workload identity profile is built on top: exactly one URI SAN holding the SPIFFE ID, keyUsage marked critical, digitalSignature on leaves, and cA set to false on leaves. See the SSL/TLS Certificate Types guide for the TLS-specific variants.
Practical consequence: an SSH certificate can say "this key may log in as deploy, from 10.20.0.0/16, and only run the release script, for the next 30 minutes". An X.509 certificate says "this key belongs to spiffe://example.org/payments/api"; what that identity may do is decided elsewhere.
Trust model and architecture
SSH. Servers trust user CAs through TrustedUserCAKeys in sshd_config, or per account through a cert-authority line in authorized_keys, optionally with a principals= list. Clients trust host CAs with an @cert-authority line in known_hosts. Through TrustedUserCAKeys, a certificate without principals is not accepted, and with the default AuthorizedPrincipalsFile of none the login name must appear among the principals. AuthorizedPrincipalsFile or a root-owned AuthorizedPrincipalsCommand maps principals such as role names to local accounts, which is where most authorisation design happens. CASignatureAlgorithms restricts which algorithms a CA may sign with; the current default list includes ssh-ed25519, ECDSA, security key types, rsa-sha2-512 and rsa-sha2-256, and ssh-mldsa44-ed25519.
X.509. Relying parties hold a trust store of roots, receive the leaf and intermediates from the peer, and run RFC 5280 path validation, checking signatures, validity, basicConstraints, name constraints and key usage at each step. This makes delegation possible: an offline root, issuing intermediates per environment, and name constraints that confine each intermediate. The SPIFFE specification notes that URI name constraints have limited library support, which affects workload PKI designs that hoped to rely on them. See the Enterprise PKI Design and CA Hierarchy Guide.
| Design question | OpenSSH CA | X.509 PKI |
|---|---|---|
| Where trust is configured | Every server (TrustedUserCAKeys) and every client (known_hosts) | Trust stores in OS, runtime, browser or service mesh |
| How to limit a CA | Separate CA keys per environment, principal naming discipline | Intermediates with nameConstraints and pathLenConstraint |
| How to rotate a CA | List old and new CA keys together, then remove the old key | Cross-sign or overlap roots and intermediates, then update trust stores |
| Where the CA key lives | HSM or token via -D (PKCS#11), or agent via -U | HSM-backed CA platform, offline root |
Threat model and failure modes
Both models move the critical secret from many end keys to a few CA keys, so CA key theft is the dominant risk in each. ATT&CK tracks the relevant behaviours as T1552.004 Private Keys, T1649 Steal or Forge Authentication Certificates, T1098.004 SSH Authorized Keys and T1553.004 Install Root Certificate.
- SSH CA key compromise: an attacker can mint a certificate for any principal every server accepts. There is no chain to cut, so recovery means distributing a new CA key and adding the old one to the KRL or removing it from TrustedUserCAKeys on every host.
- Unbounded SSH certificates: signing without -V gives a certificate valid to the distant future, which turns a short-lived design back into a standing credential.
- Principal sprawl: generic principals such as root or admin on many certificates recreate shared accounts with better paperwork.
- Bypass through authorized_keys: a CA programme that leaves AuthorizedKeysFile active still accepts any planted key, so persistence through T1098.004 remains open.
- X.509 intermediate compromise: name constraints and separate intermediates limit damage, but only where every relying library enforces them.
- Rogue trust anchors: a root added to a trust store (T1553.004) lets an attacker impersonate services; trust store control matters as much as CA control. See Certificate trust stores and root CA management.
- Silent revocation failure: X.509 clients that soft-fail on unreachable status servers accept revoked certificates; on the SSH side an unreadable RevokedKeys file refuses public key authentication for all users, which fails closed but can lock out the estate.
Revocation and lifetime
An OpenSSH KRL, built with ssh-keygen -k and updated with -u, can revoke certificates by serial or serial range, by key ID, and plain keys by contents or SHA256 fingerprint; ssh-keygen -Q tests keys against it. sshd reads it through RevokedKeys and the file should be replaced atomically. Distribution is your problem: the KRL must reach every server, and a stale copy is an open door.
X.509 publishes status. RFC 6960 OCSP returns good, revoked or unknown with thisUpdate and nextUpdate fields and can be signed by a delegated responder holding id-kp-OCSPSigning. CRLs follow RFC 5280 Section 5. The public web is moving away from OCSP: Let's Encrypt removed OCSP URLs from its certificates on 7 May 2025 and turned off its responders on 6 August 2025, citing privacy, leaving CRLs. For private PKI, check which mechanism your relying software actually enforces. The Certificate Revocation Guide covers the detail.
Shared conclusion: in both models short lifetimes do more than revocation. Minutes to hours for SSH user certificates and hours to days for workload X.509 certificates mean a stolen credential expires before most revocation pipelines would have acted.
Tooling and ecosystem
| Need | OpenSSH certificates | X.509 |
|---|---|---|
| Issue | ssh-keygen -s with -I, -n, -V, -z, -O; or a CA service that wraps the same format | CA platforms, ACME, EST, SCEP, service mesh and SPIFFE implementations |
| Inspect | ssh-keygen -L | Standard certificate parsers in every TLS library |
| Log use | sshd logs the key ID; ExposeAuthInfo writes credentials used to a file named in SSH_USER_AUTH | Application and proxy logs of client certificate subject or SAN |
| Revoke | KRL file per server | CRL or OCSP endpoint |
| Consumers | OpenSSH servers and clients, tools built on them | Browsers, TLS stacks, VPNs, Wi-Fi (802.1X), code signing, devices |
X.509 inside SSH. RFC 6187 (Standards Track, March 2011) defines public key algorithms such as x509v3-ssh-rsa, x509v3-rsa2048-sha256 and the x509v3-ecdsa-sha2-* family, under which the peer sends its certificate chain, optionally followed by OCSP responses, and the receiver validates the chain under RFC 5280. It is a real option for SSH implementations that support it; the default sshd_config algorithm lists fetched for this guide name OpenSSH certificate types, not RFC 6187 types, so confirm support for your server before planning around it. For enrolment protocols on the X.509 side see the ACME and Automated Certificate Management Guide.
When to run separate CAs
- Default, separate: one SSH user CA, one SSH host CA and an X.509 hierarchy. The user CA signs often for short periods and needs an online, HSM-held key with strict issuance policy; the host CA signs rarely; the X.509 root stays offline. Mixing them puts every signing pattern at the highest risk.
- Split SSH CAs by environment: a production user CA trusted only by production servers stops a development compromise from reaching production, the SSH equivalent of a name-constrained intermediate.
- Shared front end, separate keys: one issuance service that authenticates the requester (SSO for people, workload attestation for machines) and then signs either an SSH or an X.509 certificate from separate keys gives one audit trail without one blast radius.
- Single PKI for SSH: only where an RFC 6187 capable SSH stack is in place everywhere and policy requires one trust hierarchy; budget for path validation, revocation and certificate profile work on every server.
- Small estates: under a few dozen servers, a well-managed authorized_keys estate with short-lived keys from a secrets tool may be simpler than any CA; revisit as host counts or team churn grow.
Where non-human identities fit
Most SSH and mTLS logins in a modern estate are machines: CI runners deploying, backup jobs pulling, configuration tools connecting, services calling services. For these, the SSH certificate's forced command and source address are a least privilege tool X.509 does not offer, while X.509-SVID style certificates are the better fit for service to service calls. Give every workload certificate an owner, a key ID or SAN that names the workload, and a lifetime matched to its job. See Machine Identity vs Workload Identity vs NHI and Certificate vs Federated vs Secret-Based Machine Identity.
Worked scenario: one platform team, both formats
A platform team runs 800 Linux hosts, a Kubernetes estate and an internal TLS PKI. Engineers log in over SSH; CI deploys over SSH; services talk mTLS.
- Keep the X.509 hierarchy for TLS and mTLS with an offline root and an issuing intermediate per environment, issuing 24 hour workload certificates.
- Stand up SSH user CAs per environment with keys in an HSM, signing engineer certificates after SSO with eight hour validity and role principals mapped through AuthorizedPrincipalsFile.
- Sign CI certificates for 15 minutes with force-command for the deploy script, source-address for the runner subnet, and -O clear so no forwarding is granted.
- Add a host CA and roll @cert-authority into known_hosts so clients stop trusting first use.
- Close the bypass by setting AuthorizedKeysFile to none on production hosts once certificate logins are proven.
- Publish a KRL through configuration management with atomic replacement, and alert when any host's copy is older than one hour.
How to implement
- Inventory both sides: CA keys trusted by servers (TrustedUserCAKeys, cert-authority lines, @cert-authority), remaining authorized_keys entries, and X.509 trust stores and issuing CAs.
- Write certificate profiles: for SSH, principals naming, maximum validity per use, mandatory options; for X.509, SAN rules, key usage, lifetime per class.
- Protect CA keys: HSM or token for SSH CAs via PKCS#11, offline root for X.509, dual control on issuance policy changes.
- Pilot: trust the new SSH CA alongside existing keys on a small host group; for X.509, issue from the new intermediate to one service.
- Enforce: remove authorized_keys paths, require principals, set CASignatureAlgorithms to approved algorithms.
- Roll back: keep the previous trust configuration in configuration management so a CA or KRL error can be reverted in one change.
Detection and measurement
- Certificate share of SSH logins: percentage of successful logins using certificates rather than plain keys (target near 100% in production).
- Median SSH certificate lifetime issued for people and for automation, and any certificate issued without an end time (target zero).
- KRL freshness: hosts whose RevokedKeys file is older than the published version.
- Unknown CA keys: trusted CA keys found on hosts that are not in the CA register.
- X.509 lifetime and status coverage: share of workload certificates at or under the target lifetime, and relying services that enforce revocation.
Framework mapping
| Area | NIST CSF 2.0 | NIST SP 800-53 Rev. 5 | ATT&CK |
|---|---|---|---|
| Credential lifecycle for users, services, hosts | PR.AA-01 | IA-5(2) Public Key-based Authentication | T1552.004 |
| Authenticating services and devices | PR.AA-03 | IA-3, IA-9 | T1649 |
| CA and key management | PR.AA-01 | SC-12, SC-17 | T1553.004 |
| Remote access control | PR.AA-03 | AC-17 Remote Access | T1021.004, T1098.004 |
| Configuration of trust anchors | PR.PS-01 | SC-17 | T1557 |
Common failure patterns
- Signing without an end time, leaving SSH certificates valid indefinitely.
- One CA key for users, hosts and every environment, so one compromise reaches everything.
- Leaving authorized_keys enabled after the CA rollout, keeping the old persistence path open.
- Expecting X.509 tooling to read SSH certificates, or the reverse, and discovering the gap during an audit.
- Trusting name constraints on X.509 intermediates without testing that every relying library enforces them.
- No KRL distribution check, so a revoked certificate still works on hosts with stale files.
Practitioner checklist
- Use OpenSSH certificates for OpenSSH access and X.509 for TLS, mTLS, signing and devices.
- Keep SSH user, SSH host and X.509 CA keys separate and HSM-protected.
- Split SSH user CAs by environment.
- Always set -V; keep people to hours and automation to minutes.
- Use -O clear and grant only needed extensions; add force-command and source-address for automation.
- Require principals and map them through AuthorizedPrincipalsFile or a command.
- Disable authorized_keys on hosts that have moved to certificates.
- Distribute KRLs atomically and monitor freshness.
- Confirm RFC 6187 support before any plan to use X.509 for SSH.
Standards and references
- OpenBSD: ssh-keygen(1) manual, certificates and key revocation lists
- OpenBSD: sshd_config(5) manual
- OpenBSD: sshd(8) manual, authorized_keys and known_hosts formats
- IETF: RFC 5280, Internet X.509 PKI Certificate and CRL Profile
- IETF: RFC 6187, X.509v3 Certificates for Secure Shell Authentication
- IETF: RFC 6960, Online Certificate Status Protocol
- SPIFFE: X.509-SVID specification
- Let's Encrypt: Ending OCSP Support in 2025
Related NHI Mgmt Group resources: SSH Protocol and Certificate Authority Guide · SSH Keys vs SSH Certificates · Enterprise PKI Design and CA Hierarchy Guide · OpenSSH Server Hardening Guide