cat /dev/brain

Learning PKI

Note

I do not usually retroactively edit blog posts after writing them, but I may choose to edit this one to add to it and expand on it. It's not meant to tell a story but to explain some of the complex relationships in PKI. I've also chosen to take advantage of some features that allow for use of abbreviations while allowing you to hover over the usage to see the full text. Where, possible, I've expanded these directly in the text as well.

A few years ago, I transferred to the Data Security Department to work on our PKI inside of Salesforce. The brief description of what we do includes an internal Registration Authority that authorizes certificates from our Certificate Authority we have a contract with for externally facing certs as well as an entire internal Certificate Authority and all of the fun that entails.

When I moved over, I had a fairly basic understanding of what was involved in PKI. I had mostly consumed PKI and had learned much of what I knew from working on python-requests and certifi. However, there is a great deal to learn and many ways to approach it. Beyond constantly attempting to learn more myself, I have the honor and privilege of helping other engineers at Salesforce learn more about PKI.

Standards

PKI is based around a set of standards, best practices, and policies or requirements. The flow of standards, best practices, and requirements is fluid. Often times, one influences the other so paying attention to one is not sufficient. There are several bodies involved in these various areas:

In many ways these various bodies feed into each other. For example, a specific root program might start to push for a more stringent requirement and that may then turn into a ballot within the appropriate CA/B Forum WG (usually Server Cert). Sometimes, you'll also see another body, e.g., NIST, standardize something which then requires updates to existing RFCs in the appropriate WG or RG before it is adopted by the CA/B Forum. As an example, RFC 8657 added the ability to restrict CAA records to a specific ACME account URI. This is a stronger authorization than CAA records previously allowed for which scoped it to an entire CA.

RFC 5280

Probably the resource I refer to most often is RFC 5280. Whilst it was written in 2008 (it's nearly 20 years old!) it defines much of what is standard for PKI today. Section 4 defines X.509 for Certificates. Section 5 defines Certificate Revocation Lists (CRLs). Section 6 defines how to validate a certificate is trusted (a.k.a. Certificate Path Validation). Section 7 describes Internationalized Domain handling (i.e., handling names defined in RFC 3987 which is different from RFC 3986).

RFC 5280 also leans heavily on other RFCs and standardized languages and serialization formats that existed before it. It may be necessary to eventually learn about ASN.1 (X.680) and Distinguished Encoding Rules (a.k.a., DER, X.690)

RFC 5480

Most relevant today as we look towards making harvest now, decrypt later more difficult by by moving away from RSA keys to Elliptic Curve keys. Eventually there will likely be further RFCs specifying how to handle Subject Public Key Information for PQC keys as well as updates to TLS to support cipher suites that will work with PQC.

Baseline Requirements

Planning to start issuing certificates? These are documents you should read. If you're planning for your certificates to be publicly trusted, you MUST read these documents and adhere to them. You'll also need to read the root program policies for all of the root programs you might want to be included in.

Even if you only intend to issue certificates internal to your organization, you should probably be able to find relevant information in these documents. You will find that some X.509 and TLS implementations are more forgiving than others, while some are more strict. You might notice that something doesn't work and these will likely answer your questions.

The caveat, of course, is that you must know what your certificate will be doing to know which of the BRs to read.