Personal Key Infrastructure

Security

thumbnail

This note describes the tools and processes I use for managing secret keys.

Modern Personal Key Infrastructure (PKI) tools include sophisticated hardware and operational processes to ensure that the keys can not be stolen or compromised. This involves using a hardware security module which enforces multi-party authorization to perform any operations using the secret keys.

HSMs are not cheap. Furthermore, the firmware running on the HSM is proprietary to the manufacturer, and it’s impossible to be sure that there are no backdoors. Thankfully, there are cheaper open-source solutions like the Nitrokey HSM2, which is Common Criteria Certified and publishes its firmware on GitHub.

With this trusted hardware, I can securely store any secret key material that I need. I’ll write a note in the future describing the software and process I use with the HSM.

The HSM provides a USB interface, which I attach directly to a Raspberry Pi 3B+ for performing key operations. I boot Raspberry Pi OS from a USB flash drive, and I’ve configured the BIOS/Firmware to disable wireless networking. This way I keep the device offline. To perform software updates, I flash a new OS on a secondary USB stick, then swap them to boot off of the new stick.

Keys

I primarily use this offline set up to manage my PGP master key. The master key never leaves the HSM; instead, I use a subkey for signing, encryption, and authentication signed by the master key. These subkeys are loaded onto a Yubikey which I export for my daily use.

This page on GitHub describes a similar setup, though it uses a LUKS encrypted device to store the keys instead of an HSM.

Backups

To ensure the integrity of data, I have 2 copies of the HSM and Yubikey. This way, if one device fails, I can swap over to the other device and use that instead. I also store a paper copy of the revocation certificate.

In case of a catastrophic failure, I currently have a paper copy of the master key pair. However, I plan to destroy this copy once I’ve established confidence in the reliability of the HSMs, and I’ve explored an encrypted backup solution.

All the backups are stored in a physical safe to ensure the security of data.