PKI, Certificates and Security Tutorial

3 Min Read • Published on Nov 25, 2026
Tutorial contents
In this page

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.

Lab keys only
Everything in this tutorial uses throwaway keys in an empty directory. Never paste a private key from a real system into a blog, a chat or an AI tool, and never reuse a tutorial key for anything real.

How to read it

Read the pages in order the first time. Later, use them as a reference.

#PageYou will learn
1Cryptography basicsHashes, HMAC, symmetric encryption, public/private keys, signatures, key exchange, post-quantum
2How HTTPS worksWho 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
3Certificates and PKIWhat a CA is, X.509 fields, CSRs, chains, trust stores, TLS handshake, revocation
4Key and file formatsPEM vs DER, PKCS#1, #7, #8, #10, #12, and why files will not load
5SSH certificates and ssh-agentOne story from SSH CA to signed certificate to ssh-agent to a real login, and why certificates beat authorized_keys
6JWT, JWK, OIDC, SSO and SAMLIdentity tokens, signing keys, login flows
7LDAP and Active Directory on LinuxDirectories, AD, and how NSS, PAM and SSSD turn them into Linux logins
8Enrollment protocolsACME, SCEP (static and dynamic), EST, ACME device attestation
9Protecting keysSoftware keys, HSMs, cloud KMS, PKCS#11, a hands-on SoftHSM session
10FIPS 140-2 and 140-3What the standards mean, and what they do not
11Operations checklistThe things newcomers are rarely told: expiry, trust, time, logging
12OpenSSL cheat sheetThe 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
macOS and LibreSSL
The 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 →

Start Your Free Trial Now

Try BastionXP for free with no commitments. No credit card required.