Building a PKI: root CA, intermediate CA, Windows, smartcard

How many tiers does a PKI need?

In its planning guidance for CA hierarchies, Microsoft distinguishes three common forms: one-tier, two-tier and three-tier. For most environments Microsoft recommends the two-tier design: a root CA that stays offline and a subordinate issuing CA that runs online. The planning guidance was last updated on 31 August 2016 and names Windows Server 2003 with SP2, 2008 R2, 2012 R2 and 2012 as its scope, so older Windows Server versions.

The three forms in detail:

  • One-tier: A single CA is both root and issuing CA. Microsoft calls this not recommended for any production scenario, because a compromise of that one CA compromises the whole PKI.
  • Two-tier: A root CA signs one or more issuing CAs. According to Microsoft, several issuing CAs allow different locations and security levels, and the extra cost is small because all you need is another server or a virtual machine.
  • Three-tier: An intermediate tier sits between the root and the issuing CA, for example as a policy CA that separates classes of certificates or administrative boundaries. Microsoft usually advises against it, except in a few special cases. Without such boundaries the middle tier goes unused, and administration gets harder.

What terms such as root, intermediate and certificate chain mean is explained in What is a PKI?. The role of the CA itself is covered in What is a certificate authority (CA)?.

Why does the root CA stay offline?

According to Microsoft Learn, the root CA is the most important CA in the hierarchy. If it is compromised, all CAs below it and all certificates they issued are considered compromised. In addition, Microsoft says a replacement root certificate is hard to distribute quickly, especially to computers that are not domain members and to devices that need a special process for the root certificate.

Microsoft describes what “offline” means:

  • The server never has a network connection. If it runs on physical hardware, no network cable is ever plugged in, and ideally the network card is missing.
  • Files move on removable media that is scanned for malware first, and only on authorized devices.
  • If the root runs as a virtual machine, it needs a dedicated, physically secured host, and Microsoft recommends an HSM for it.
  • When it is not in use, host and HSM are shut down completely.

This has a price: Microsoft names updating, maintenance and access as new challenges, and the root has to go online briefly to sign CRLs. According to RFC 5280, every CRL carries a nextUpdate field, the date by which the next CRL will be issued. It follows that the root needs a fixed date on which it is started beforehand to issue a new CRL.

Which validity periods suit the tiers?

As a rule of thumb, Microsoft says a CA certificate should be valid at least twice as long as the longest certificates that CA issues. If a CA issues two-year certificates, its own certificate should be valid for at least four years. Applied to the tiers, that means the root is valid longest, the issuing CAs follow, and the certificates for servers, devices and users come last.

The reason: a Windows CA does not issue certificates that outlast its own CA certificate. If the CA certificate expires in 18 months, a certificate meant to last two years gets only 18 months. When a certificate is checked, every CA certificate in the chain is also checked for expiry.

For renewal, Microsoft recommends renewing a CA certificate once with the same key pair and the next time with a new one. As an example, Microsoft shows a CAPolicy.inf for a root CA with a 4096-bit key and a renewal validity of 20 years. That is an example, not a requirement: which numbers suit you depends on the certificates issued below it.

How do you keep revocation information reachable?

A client checks not only the chain but also whether a certificate has been revoked. Two extensions in the certificate tell it where to look:

  • CRL distribution point (CDP): The cRLDistributionPoints extension states how to obtain the revocation list. According to RFC 5280, several names describe different ways to get the same CRL, for example LDAP and HTTP.
  • Authority information access (AIA): The authorityInfoAccess extension names services of the issuer. With id-ad-caIssuers it points to certificates issued to the issuing CA itself, with id-ad-ocsp to an OCSP responder.

RFC 5280 keeps the two apart explicitly: the location of CRLs is not in the AIA extension but in the CDP. Which addresses a CA writes into newly issued certificates is set in the CA’s properties on the “Extensions” tab. Microsoft’s example guide removes the default entries there and enters an HTTP address on a separate host, with the check boxes “Include in the CDP extension of issued certificates” and “Include in the AIA of issued certificates”.

What belongs to OCSP?

Active Directory Certificate Services includes the Online Responder for this. It receives requests for the revocation status of a certificate, evaluates it and returns a signed response. Microsoft explicitly lists managing and verifying CRL and OCSP availability among the ongoing tasks of a CA.

The PKI Toolkit names the AIA caIssuers address when an intermediate certificate is missing and the existing certificate carries such a URL. It works entirely in the browser, without upload.

How do you protect the CA’s key?

According to Microsoft, the private key is part of a CA’s identity and must be protected from compromise. Many organizations keep it in a hardware security module (HSM). Without an HSM, the key sits on the CA computer.

Microsoft describes the risk of a default AD CS installation without an HSM: the key is protected through the Data Protection API and is exportable by default. Anyone with local administrator rights can back it up or export it and use it elsewhere.

For production CAs Microsoft therefore recommends an HSM, while also calling it a significant capital investment. Microsoft considers software keys acceptable only for low-assurance environments such as a lab or proof of concept, or when an HSM is not feasible for operational or financial reasons.

How do you limit an issuing CA?

An issuing CA should only be able to issue what it is meant for. Microsoft names a path length constraint and limited extended key usages (EKU) in the issuing CA’s certificate as the best way. The aim is that a security breach at one CA, for example for server authentication, does not affect other uses such as smart cards. Microsoft points out that this should not be the only mitigation, because several enterprise CAs in Active Directory share certificate templates.

According to RFC 5280, section 4.2.1.9, the path length (pathLenConstraint) gives the maximum number of intermediate certificates that may follow this CA certificate in a valid path. Only intermediate certificates that are not self-issued are counted. At 0, no such intermediate certificate may follow. Where it is absent, no limit applies.

What applies to algorithms and key lengths?

Microsoft recommends using the same algorithm family within a hierarchy: a CA with an RSA key should not certify a subordinate CA with an ECC key. A CA’s key should be at least as long as the keys it certifies. Before moving to newer algorithms, test compatibility with the applications that check certificates.

How does Windows fit in?

According to Microsoft Learn, Active Directory Certificate Services (AD CS) is a Windows Server role for issuing and managing PKI certificates. Windows Server supports four CA types: Enterprise Root CA, Enterprise Subordinate CA, Standalone Root CA and Standalone Subordinate CA.

The difference is how they are tied to Active Directory:

  • Enterprise CAs are integrated with AD DS, publish certificates and CRLs there, and use certificate templates. Only they allow automated certificate approval and automatic user certificate enrollment.
  • Standalone CAs need neither AD DS nor templates. By default, requests wait in a queue until an administrator approves them.

The individual steps for setting up a CA on Windows are in Setting up your own certificate authority (CA) on Windows.

What does smart card sign-in have to do with the PKI?

When a user signs in to a domain with a smart card, Windows uses Kerberos V5 with X.509 v3 certificates, according to Microsoft Learn. Smart cards work only for domain accounts or Microsoft Entra ID accounts, not for local accounts. For new Windows installations, however, Microsoft recommends Windows Hello for Business or FIDO2 security keys.

Three things follow for the PKI:

  1. The issuing CA must be an enterprise CA, because according to Microsoft only enterprise CAs issue certificates for smart card sign-in.
  2. The card’s certificate needs the “Digital Signature” key usage. If it contains an extended key usage, that must include smart card sign-in.
  3. The domain controller checks the time, path and revocation status of the certificate. It builds a path to a root CA in the domain controller’s root store and also requires the issuer to be in the NTAUTH certificate store.

It follows that the revocation information must be reachable from the domain controllers.

Which alternatives to Windows exist?

The tier logic applies regardless of the product. Two examples from the vendors’ documentation:

  • step-ca (Smallstep): According to its documentation, it is an online CA for X.509 and SSH certificates, designed for a two-tier PKI with one root and one intermediate CA. The root CA is always offline, and a single-tier PKI is not supported. As a limitation, the documentation lists very limited options for active revocation through CRL or OCSP. For protecting the signing keys there are integrations for PKCS #11 HSMs, Google Cloud KMS, AWS KMS and YubiKey PIV.
  • EJBCA (Keyfactor): According to its documentation, it can implement virtually any type of PKI architecture, from a self-contained internal PKI to infrastructure with high availability requirements. Certificate validation works through CRL and OCSP.

Whether you run the PKI yourself or have a provider do it is compared in Managed PKI or your own PKI.

Sources

Let's talk

Free initial consultation - no sales pitch, just an honest assessment.

Request a consultation →