A public-key infrastructure (PKI) is a set of roles, policies, hardware, software and procedures needed to create, manage, distribute, use, store and revoke digital certificates and manage public-key encryption. The algorithms are based on Publick-key cryptography. The format of the digital certificate is defined in X.509 standard.
Certificate Authority – CA digitally signs and publishes the public key to user. Website requesting certificates start with a key pair. It then converts public key into CSR (certificate signing request), including the identity. Once the identity of requestor is validated, CA will sign the public key of requestor, using its own private key. The output of this is the certificate.
Registration Authority – CA may delegate some roles to registration authority (RA). RA is responsible for accepting requests for certificates and authenticating the entity making the request. However, RAs do not have the signing authority of a CA. Note that Microsoft may have referred to a subordinate CA as an RA, which is incorrect according to X.509 PKI standards.
- Domain Validation: domain ownerships is usually verified via DNS record.
- Organization Validation: the organization name and address are verified and put into the certificate.
- Extended Validation: verifies existence and location of the legal entity, as well as domain ownership. EV cannot be issued as a wildcard certificate.
Private Certificate Authorities
You can create private CA and use it to sign certificates. Your user need to manually install and trust your private CA so that all certificates issued from the CA will inherit that trust. For revocation, you will also need to maintain an HTTP server for the certificate revocation list, or an OCSP responder.
Certificate Revocation List (CRL)
SSL certificates include information on how to access a certificate revocation list. Client will download and check this list to make sure the certificate has not been revoked. This mechanism has largely been replaced by OCSP responders.
Online Certificate Status Protocol (OCSP)
The OCSP protocol is a replacement for CRLs, with the benefit of being more real-time and requiring less bandwidth. The general operation is similar: clients are to query to OCSP responder to check if a certificate has been revoked.
Commercial vs non-profit CA
|Commercial (e.g. SSLs.com)||Non-profit (e.g. Let’s Encrypt)|
|Validation||DV, OV and EV||DV only|
|Wildcard||Supported||Supported (using DNS-01 challenge via ACME v2)|
|Expiration||1-3 years||90 days|
Traditionally, there are several command-line utilities such as openssl, cfssl, or keytool (Java) to manage certificate related tasks. The process are mostly manual. The Internet Security Research Group (ISRG) developed the ACME (Automated Certificate management Environment) protocol.
In this protocol, there is a certificate management agent (client) on the given web server. The agent generates a key pair and shares it with the CA at the outset of the validation process. Once validation is finished and the agent is verified as the proven owner of the key pair. It can use its key to digitally sign the CSRs it generates and sends to the CA via HTTPS requests. The CA uses the CSR, along with its associated public key, to issue the certificate and send it back to the agent. The agent downloads and installs it, then notifies the designated contact. The agent can be automated to check in with the CA at given intervals to rotate certificates and keys.
Let’s encrypt adopts ACME protocol by using Boulder on the server side, and the most commonly used client is certbot. Smallstep also introduced ACME support in step CA in 2019.
I have used let’s encrypt several times because it is free and easy to manage with certbot, which can be installed using
brew on Mac. Here’s how I quickly generate certificate manually:
DOMAIN=orthwebdemo.digihunch.com echo $DOMAIN sudo certbot -d $DOMAIN --manual --preferred-challenges dns certonly # get ready to change txt record ls /etc/letsencrypt/live/orthwebdemo.digihunch.com/
--manual switch starts interactive prompts, which includes configuring TXT record and wait for the update.
Open source implementations
Here is a list of open-source implementations of PKI management:
- OpenSSL: classic tool for PKI management. The Mac/BSD implementation and GNU implementation are slightly different.
- Keytool: Java’s Key and Certificate Management Tool that supports formats used in Java
- Cfssl: introduced by CloudFlare to simplify the PKI management process. On Ubuntu, the apt package name is golang-cfssl
- Hashicorp Vault: CA, secret management and encryption.
- Boulder: implemented in Go based on ACME protocol. Let’s Encrypt uses Boulder on the server side.
- EJBCA: a full-featured, enterprise-grade implementation in Java, managed by Swedish company PrimeKey Solutions AB.
Managed CA as service
- AWS Certificate Manager
- EJBCA Enterprise, as Azure Market place
- Google Cloud Certificate Authority Service API