diff --git a/openpgp-card-sequoia/src/main.rs b/openpgp-card-sequoia/src/main.rs index b6a5c94..f046b38 100644 --- a/openpgp-card-sequoia/src/main.rs +++ b/openpgp-card-sequoia/src/main.rs @@ -80,12 +80,18 @@ fn main() -> Result<(), Box> { // --------------------------------------------- assert_eq!(app_id.ident(), test_card_ident); + let check = oc.check_pw3(); + println!("has pw3 been verified yet? {:x?}", check); + oc.factory_reset()?; match oc.verify_pw3("12345678") { Ok(oc_admin) => { println!("pw3 verify ok"); + let check = oc_admin.check_pw3(); + println!("has pw3 been verified yet? {:x?}", check); + let res = oc_admin.set_name("Bar< Result<(), Box> { // Check that we're still using the expected card assert_eq!(app_id.ident(), test_card_ident); + let check = oc.check_pw1(); + println!("has pw1/82 been verified yet? {:x?}", check); + match oc.verify_pw1("123456") { Ok(oc_user) => { println!("pw1 82 verify ok"); + let check = oc_user.check_pw1(); + println!("has pw1/82 been verified yet? {:x?}", check); + let cert = Cert::from_file(TEST_KEY_PATH)?; let msg = std::fs::read_to_string(TEST_ENC_MSG) .expect("Unable to read file"); diff --git a/openpgp-card/src/lib.rs b/openpgp-card/src/lib.rs index 3925420..5dbef09 100644 --- a/openpgp-card/src/lib.rs +++ b/openpgp-card/src/lib.rs @@ -587,6 +587,11 @@ impl CardBase { Err(self) } + pub fn check_pw1(&self) -> Result { + let verify = commands::verify_pw1_82(vec![]); + apdu::send_command(&self.card, verify, Le::None, Some(&self)) + } + pub fn verify_pw1(self, pin: &str) -> Result { assert!(pin.len() >= 6); // FIXME: Err @@ -603,6 +608,11 @@ impl CardBase { Err(self) } + pub fn check_pw3(&self) -> Result { + let verify = commands::verify_pw3(vec![]); + apdu::send_command(&self.card, verify, Le::None, Some(&self)) + } + pub fn verify_pw3(self, pin: &str) -> Result { assert!(pin.len() >= 8); // FIXME: Err