feat: openpgp card test

This commit is contained in:
2022-03-27 22:29:40 +08:00
parent cf044ba7d0
commit 3a0956d651
3 changed files with 42 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
use anyhow::Result;
use openpgp_card::OpenPgp;
use openpgp_card_pcsc::PcscBackend;
use openpgp_card_sequoia::card::Open;
fn main() -> Result<()> {
println!("The following OpenPGP cards are connected to your system:");
for mut card in PcscBackend::cards(None)? {
let mut pgp = OpenPgp::new(&mut card);
let open = Open::new(pgp.transaction()?)?;
println!(" {}", open.application_identifier()?.ident());
println!(" {}", open.application_identifier()?.application());
println!(" {}", open.application_identifier()?.version());
println!(" {:?}", open.fingerprints());
}
Ok(())
}