Skip to content

Commit 434d224

Browse files
committed
PIV: remove additional PIV MGM methods
`Yubikey` hosts methods to do authentication with the MGM key in a one shot method, and via broken out methods (`get_auth_challenge` and `verify_auth_response`). These methods are a little hard to make work with AES or 3DES keys and currently have no integration tests. Rather than having duplicate logic (and subsequently duplicating error tests), these methods are being removed.
1 parent 48305cc commit 434d224

File tree

1 file changed

+0
-50
lines changed

1 file changed

+0
-50
lines changed

src/yubikey.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ use {
6666
/// Flag for PUK blocked
6767
pub(crate) const ADMIN_FLAGS_1_PUK_BLOCKED: u8 = 0x01;
6868

69-
/// 3DES authentication
70-
pub(crate) const ALGO_3DES: u8 = 0x03;
71-
7269
/// Card management key
7370
pub(crate) const KEY_CARDMGM: u8 = 0x9b;
7471

@@ -628,53 +625,6 @@ impl YubiKey {
628625
txn.save_object(object_id, indata)
629626
}
630627

631-
/// Get an auth challenge.
632-
#[cfg(feature = "untested")]
633-
pub fn get_auth_challenge(&mut self) -> Result<[u8; 8]> {
634-
let txn = self.begin_transaction()?;
635-
636-
let response = Apdu::new(Ins::Authenticate)
637-
.params(ALGO_3DES, KEY_CARDMGM)
638-
.data([0x7c, 0x02, 0x81, 0x00])
639-
.transmit(&txn, 261)?;
640-
641-
if !response.is_success() {
642-
return Err(Error::AuthenticationError);
643-
}
644-
645-
Ok(response
646-
.data()
647-
.get(4..12)
648-
.ok_or(Error::SizeError)?
649-
.try_into()?)
650-
}
651-
652-
/// Verify an auth response.
653-
#[cfg(feature = "untested")]
654-
pub fn verify_auth_response(&mut self, response: [u8; 8]) -> Result<()> {
655-
let mut data = [0u8; 12];
656-
data[0] = 0x7c;
657-
data[1] = 0x0a;
658-
data[2] = 0x82;
659-
data[3] = 0x08;
660-
data[4..12].copy_from_slice(&response);
661-
662-
let txn = self.begin_transaction()?;
663-
664-
// send the response to the card and a challenge of our own.
665-
let status_words = Apdu::new(Ins::Authenticate)
666-
.params(ALGO_3DES, KEY_CARDMGM)
667-
.data(data)
668-
.transmit(&txn, 261)?
669-
.status_words();
670-
671-
if !status_words.is_success() {
672-
return Err(Error::AuthenticationError);
673-
}
674-
675-
Ok(())
676-
}
677-
678628
/// Reset YubiKey.
679629
///
680630
/// WARNING: this is a destructive operation which will destroy all keys!

0 commit comments

Comments
 (0)