The OpenPGP function on a multi-protocol security key such as the YubiKey 5 acts as an OpenPGP smart card. It holds your GnuPG keys so that signing, decryption and SSH logins happen on the key; the private keys cannot be copied from it. It is not used for web sign-in.
Typical uses are signing Git commits and software releases, encrypting files and email (for example with Thunderbird), and SSH through gpg-agent.
Three keys, three jobs
An OpenPGP card holds three keys:
- Signature: signs commits, releases and messages.
- Encryption: decrypts what others encrypt to you.
- Authentication: used for SSH logins through
gpg-agent.
YubiKey 5 keys with firmware 5.2.3 or later support elliptic-curve keys as well as RSA.
Change the defaults first
Yubico ships every key with the same OpenPGP PINs: user PIN 123456 and admin PIN 12345678. Change both before you load any keys, with GnuPG (gpg --card-edit, then admin and passwd) or with Yubico’s tool:
ykman openpgp access change-pin
ykman openpgp access change-admin-pin
To require a physical touch for every signature, decryption or SSH login, set the touch policy, for example ykman openpgp keys set-touch sig on. This stops malware from using the key silently while it is plugged in.
Generate on the key, or import?
| Generate on the key | Generate offline, then import | |
|---|---|---|
| Private key ever outside hardware | Never | Briefly, on the machine that created it |
| Backup possible | No: a lost key means a new key pair | Yes: keep the offline copy safely |
| Good for | Signing keys you can rotate | Encryption keys, where losing the key loses access to old encrypted data |
A common pattern is a long-lived primary key kept offline, with signing, encryption and authentication subkeys imported to two security keys.
SSH: OpenPGP or FIDO2?
If SSH is all you need, FIDO2 SSH keys (ed25519-sk) are simpler: no GnuPG and no gpg-agent, and the key works with standard OpenSSH. SSH and Git signing with a security key covers that route. Choose OpenPGP when you already use GnuPG for signing or encryption and want one key for everything.
macOS note
Yubico notes that GnuPG on macOS can conflict with other smart card software such as OpenSC. If the card is not detected, check which software has claimed it first.
Related
- Choosing a YubiKey: OpenPGP needs the multi-protocol 5 Series.
- Recovering from a lost security key.