Add a "test" fn that prints algorithm information for cards.
This commit is contained in:
parent
608e6533a6
commit
3edadb8607
1 changed files with 25 additions and 1 deletions
|
@ -36,7 +36,9 @@ use sequoia_openpgp::Cert;
|
|||
|
||||
use openpgp_card::card_app::CardApp;
|
||||
use openpgp_card::errors::{OcErrorStatus, OpenpgpCardError};
|
||||
use openpgp_card::{KeyType, PublicKeyMaterial, Sex};
|
||||
use openpgp_card::{
|
||||
Algo, Curve, EccAttrs, EccType, KeyType, PublicKeyMaterial, RsaAttrs, Sex,
|
||||
};
|
||||
|
||||
use crate::cards::{TestCard, TestConfig};
|
||||
|
||||
|
@ -180,6 +182,25 @@ fn test_print_caps(
|
|||
Ok(vec![])
|
||||
}
|
||||
|
||||
fn test_print_algo_info(
|
||||
ca: &mut CardApp,
|
||||
_param: &[&str],
|
||||
) -> Result<TestOutput, TestError> {
|
||||
let ard = ca.get_app_data()?;
|
||||
|
||||
let dec = CardApp::get_algorithm_attributes(&ard, KeyType::Decryption)?;
|
||||
println!("Current algorithm for the decrypt slot: {}", dec);
|
||||
|
||||
println!();
|
||||
|
||||
let algo = ca.list_supported_algo();
|
||||
if let Ok(Some(algo)) = algo {
|
||||
println!("Card algorithm list:\n{}", algo);
|
||||
}
|
||||
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
fn test_upload_keys(
|
||||
ca: &mut CardApp,
|
||||
param: &[&str],
|
||||
|
@ -411,6 +432,9 @@ fn main() -> Result<()> {
|
|||
println!("Reset");
|
||||
let _ = run_test(&mut card, test_reset, &[])?;
|
||||
|
||||
// println!("Algo info");
|
||||
// let _ = run_test(&mut card, test_print_algo_info, &[])?;
|
||||
|
||||
println!("Generate key");
|
||||
let _ = run_test(&mut card, test_keygen, &[])?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue