feat: pgp decrypt
This commit is contained in:
@@ -18,3 +18,20 @@ pub fn get_card_user_sw1_81(pass: &str) -> XResult<OpenPGPCardUser> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_card_user_sw1_82(pass: &str) -> XResult<OpenPGPCardUser> {
|
||||
match OpenPGPCard::list_cards() {
|
||||
Ok(list) => {
|
||||
// pw1_82 for decrypt
|
||||
// PKCSv1.5
|
||||
if list.is_empty() {
|
||||
return simple_error!("Cannot find any card");
|
||||
}
|
||||
match list.into_iter().next().unwrap().verify_pw1_82(pass) {
|
||||
Result::Ok(user) => Ok(user),
|
||||
Result::Err(_) => simple_error!("Verify pw1_82 OpenPGP card failed"),
|
||||
}
|
||||
}
|
||||
Err(e) => simple_error!("Read OpenPGP card failed: {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user