Skip to content
SecureKeys

Learn

Smart card login with a security key (PIV): when to use it and how to set it up safely

What the PIV smart card function on a YubiKey or similar key does, how it differs from FIDO2 passkeys, which slots hold which certificates, and the defaults you must change first.

SecureKeys Engineering ·

PIV (Personal Identity Verification, the US FIPS 201 standard) turns a multi-protocol security key such as the YubiKey 5 into a smart card. It holds private keys and X.509 certificates, and it is mainly used outside the browser: Windows and domain logon, VPN and Wi-Fi certificates, document and email signing, and code signing. Windows supports it natively; macOS and Linux use it through middleware such as OpenSC.

PIV or FIDO2?

Need Use
Sign in to websites, Google Workspace, Microsoft 365, Odoo FIDO2 / passkeys. Simpler, no certificates to issue.
Windows logon to an Active Directory domain with an existing PKI PIV smart card
Certificate-based sign-in already required by policy (Microsoft Entra CBA, VPN, government systems) PIV smart card
Signing PDFs, email (S/MIME) or code with a certificate PIV smart card

If you have no certificate authority today, start with FIDO2. PIV needs a PKI to issue and revoke certificates, usually Active Directory Certificate Services, and someone who looks after it.

The slots

A PIV key stores keys and certificates in numbered slots, each with a defined purpose:

Slot Name Typical use
9A PIV Authentication Logging in to the computer or network
9C Digital Signature Signing documents, email and code
9D Key Management Decrypting email and files
9E Card Authentication Physical access, often without a PIN
82 to 95 Retired keys Old decryption keys, so older encrypted data stays readable

On YubiKey 5 firmware 5.7 and later, Yubico lists room for 24 PIV certificates.

Change the defaults before anything else

Every YubiKey ships with the same published PIV values: PIN 123456, PUK 12345678 and a well-known management key. Anyone holding the key can use these until you change them.

  1. Change the PIN (6 to 8 characters). Users enter it at logon.
  2. Change the PUK. It unblocks a PIN after too many wrong attempts. Keep it with the administrator, not on a sticky note.
  3. Change the management key. It controls key generation and certificate loading. ykman can generate a random one and store it on the key, protected by the PIN.

With Yubico’s command-line tool:

ykman piv access change-pin
ykman piv access change-puk
ykman piv access change-management-key --generate --protect

On Windows, if the Yubico smart card minidriver sees a default management key and PUK the first time a key is used, it replaces the management key and blocks the PUK. Set a PUK yourself first if you want users to be able to recover from a blocked PIN.

If both PIN and PUK are blocked, or the management key is lost, the only way back is a reset of the PIV function, which deletes its keys and certificates.

A safe rollout order

  1. Confirm your certificate authority can issue smart card logon certificates, and that revocation (CRL or OCSP) works from every site.
  2. Generate keys on the security key (slot 9A), so the private key never exists anywhere else, and issue the certificate to it.
  3. Issue two keys per administrator, as with FIDO2.
  4. Pilot with IT staff before enforcing “smart card required” on any account. Keep a break-glass account that does not depend on the PKI.
  5. Write down the reset process: who can unblock a PIN with the PUK, and how a lost key’s certificate is revoked.

References

  1. Yubico developers: PIV introduction
  2. Yubico developers: PIV device setup
  3. Yubico SDK manual: PIV slots
  4. Yubico technical manual: Smart Card (PIV compatible)
  5. Yubico: Smart Card Minidriver, setting the PUK
  6. Microsoft Learn: Certificate-based authentication in Microsoft Entra ID
  7. NIST: FIPS 201-3, Personal Identity Verification

Plan your move beyond passwords

Talk to our engineers about phishing-resistant authentication for your organisation. We reply within one business day.