Conversation
obelisk
commented
Apr 16, 2025
src/yubikey/piv/management.rs
Outdated
| [0u8; 20], | ||
| None, | ||
| &[RelativeDistinguishedName::common_name(common_name)], | ||
| SerialNumber::new(&[0; 8]).unwrap(), |
Owner
Author
There was a problem hiding this comment.
This should generate a random serial
| /// Provisions the YubiKey with a new certificate generated on the device. | ||
| /// Only keys that are generated this way can use the attestation functionality. | ||
| pub fn provision( | ||
| pub fn provision<KT: yubikey_signer::KeyType>( |
Owner
Author
There was a problem hiding this comment.
I think we hide this away and just provide two non-generic functions for p256 and p384
| PublicKeyInfo::Rsa { pubkey: _, .. } => panic!("RSA keys not supported"), | ||
| PublicKeyInfo::EcP256(pubkey) => (pubkey.as_bytes().to_vec(), AlgorithmId::EccP256), | ||
| PublicKeyInfo::EcP384(pubkey) => (pubkey.as_bytes().to_vec(), AlgorithmId::EccP384), | ||
| let cert = yk.configured(&slot).unwrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New Yubikeys come with AES rather than TDES management keys so we need to support that. Support is forthcoming in a new version of the Yubikey library but that means we must be current to get it. This upgrades us from Yubikey 0.7 to Yubikey 0.8.
This is still a work in progress, it compiles and appears to work but I'm not thrilled with the new API, nor the need to pull in both p256 and p384. Technically we should be able to get rid of those by creating our own types and implementing KeyType for them via
ringbut I don't know how much effort this is going to be.