This tutorial is for anyone who is new to cryptography and PKI. It starts from “what is a hash?” and ends at “why does my CA keep its key in an HSM, and what does FIPS 140-3 have to do with it?”
Every page uses the openssl command line (and ssh-keygen, pkcs11-tool)
on real keys and real certificates. The output shown was produced by
running the commands, so you can run them too and compare. Your keys,
serial numbers and dates will differ; the shape of the output will not.
How to read it
Read the pages in order the first time. Later, use them as a reference.
| # | Page | You will learn |
|---|---|---|
| 1 | Cryptography basics | Hashes, HMAC, symmetric encryption, public/private keys, signatures, key exchange, post-quantum |
| 2 | How HTTPS works | Who does what in TLS: RSA and ECDSA sign, ECDHE agrees a secret, HKDF makes keys, AES-GCM encrypts. TLS 1.2 vs 1.3, legacy RSA key transport |
| 3 | Certificates and PKI | What a CA is, X.509 fields, CSRs, chains, trust stores, TLS handshake, revocation |
| 4 | Key and file formats | PEM vs DER, PKCS#1, #7, #8, #10, #12, and why files will not load |
| 5 | SSH certificates and ssh-agent | One story from SSH CA to signed certificate to ssh-agent to a real login, and why certificates beat authorized_keys |
| 6 | JWT, JWK, OIDC, SSO and SAML | Identity tokens, signing keys, login flows |
| 7 | LDAP and Active Directory on Linux | Directories, AD, and how NSS, PAM and SSSD turn them into Linux logins |
| 8 | Enrollment protocols | ACME, SCEP (static and dynamic), EST, ACME device attestation |
| 9 | Protecting keys | Software keys, HSMs, cloud KMS, PKCS#11, a hands-on SoftHSM session |
| 10 | FIPS 140-2 and 140-3 | What the standards mean, and what they do not |
| 11 | Operations checklist | The things newcomers are rarely told: expiry, trust, time, logging |
| 12 | OpenSSL cheat sheet | The commands you will use every week |
Set up your lab
You need openssl 3.x or newer, and for some pages ssh-keygen (part of
OpenSSH) and softhsm2-util plus pkcs11-tool (OpenSC).
$ openssl version
OpenSSL 4.1.0 23 Oct 2026 (Library: OpenSSL 4.1.0 23 Oct 2026)
$ mkdir pki-lab && cd pki-lab
openssl that ships with macOS is LibreSSL, which lacks some options
used here. Install the real one with brew install openssl and call it by
its full path, or put it first in your PATH.All commands run in this one pki-lab directory, so files from earlier
pages (root.crt, web.key, …) are reused on later pages.
The big picture in one minute
- Hashing proves data did not change.
- Symmetric encryption hides data, fast, with a shared secret.
- Public-key cryptography lets strangers prove who they are and agree on secrets, without sharing a secret first.
- A certificate is a signed statement: “this public key belongs to this name”. A CA is whoever signs it.
- PKI is everything around that: issuing, trusting, renewing, revoking.
- Protocols such as ACME and SCEP automate getting certificates; OIDC and SAML prove which person is asking.
- HSMs and KMS keep the most important private keys safe; FIPS is how governments test that they do.
About BastionXP
BastionXP is a cloud-native private PKI CA and device identity management platform that eliminates passwords and shared secrets by issuing hardware-attested certificates to mobile devices and laptops. Secure access to your Wi-Fi, VPN, and SaaS applications in your enterprise network. Replace legacy SCEP with automated ACME Device Attestation. No shared secrets. Zero credential theft. Learn more about BastionXP →