Skip to content

PIV unlock should fetch management key alg instead of using firmware default - #36

Merged
timweri merged 3 commits into
mainfrom
thanh/fetch-management-key-algorithm-on-unlocks
Jul 30, 2026
Merged

PIV unlock should fetch management key alg instead of using firmware default#36
timweri merged 3 commits into
mainfrom
thanh/fetch-management-key-algorithm-on-unlocks

Conversation

@timweri

@timweri timweri commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Currently, PIV assumes the management key algorithm is the default based on the firmware version. This PR dynamically fetches the algorithm from the Yubikey.

Tested with:

  • Yubikey with TDES as default
  • Yubikey with AES192 as default
  • Yubikey with TDES as non-default

Reviewed by Opus 5 and Copilot.

@timweri
timweri requested a review from Copilot July 28, 2026 16:08
@timweri
timweri marked this pull request as ready for review July 28, 2026 16:09
@timweri
timweri requested a review from obelisk July 28, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates YubiKey PIV unlocking to authenticate using the management key algorithm actually configured on the device (via PIV metadata), rather than always assuming the firmware default. This improves compatibility with devices configured with non-default management key algorithms (e.g., AES).

Changes:

  • Read the management key algorithm from the PIV management slot metadata when available, falling back to the device firmware default when not supported.
  • Refactor management-key construction to use the discovered algorithm during unlock().
  • Extend yubikey::piv imports to include management-slot/metadata algorithm types needed for the lookup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@timweri
timweri merged commit b611358 into main Jul 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants