Goal: for PGP key associated with role and shared between multiple people
(security-officer and similar roles), we would like to have a formalized
way of rotating and sharing of the PGP key.
This procedure assumes that all parties are trustworthy and do not deliberately act in malice.
Ed25519
with an expiration time of no more than 5 years [1].gpg --output so.pgp --export-secret-key security-officer@FreeBSD.org
so.pgp
with another layer of encryption, with a passhprase K1, and deletes encrypted export in previous step[2]:openssl enc -aes256 -base64 -in so.pgp -out so.pgp.enc && rm so.pgp
so.pgp.enc
) to the recipient, encrypted with the recipient's public PGP key[3].so.pgp.enc
file with their own PGP private key.openssl dec -ase256 -base64 -in so.pgp.enc -out so.pgp && rm so.pgp.enc
gpg --import so.pgp
gpg --edit-key security-officer@FreeBSD.org
so.pgp
[1] Ed25519 is the default for GPG; for best compatibility, a 4096-bit RSA key can be used instead, but in 2022, it's likely that this is no longer a concern. The 5 year expiration in this context is an arbitrary value.
[2] This step avoids sending the passphrase protected PGP key without an additional layer of encryption (by accident).
[3] Encrypting the encrypted file with recipient's PGP key ensures the recipient has control of both their mailbox and the private key.
[4] This should be separate; the recipient should get the passphrase and remove them from the server once they got access to it.
[5] This step is both authenticating the recipient and to separate risks of leaks; in worst case, the attacker still need to have the other part of the passphrase in order to decrypt the outside wrap.