32 lines
985 B
Rust
32 lines
985 B
Rust
use anyhow::Result;
|
|
use openpgp_card::OpenPgp;
|
|
use openpgp_card_pcsc::PcscBackend;
|
|
|
|
fn main() -> Result<()> {
|
|
println!("The following OpenPGP cards are connected to your system:");
|
|
|
|
let cards = PcscBackend::cards(None).expect("list cards");
|
|
println!("Found {} cards", cards.len());
|
|
for mut card in PcscBackend::cards(None)? {
|
|
let mut pgp = OpenPgp::new(&mut card);
|
|
let mut trans = pgp.transaction()?;
|
|
|
|
// println!("== {:?}", trans);
|
|
match trans.url() {
|
|
Ok(url) => println!("{}", String::from_utf8_lossy(&url)),
|
|
Err(e) => eprintln!("{:?}", e),
|
|
}
|
|
|
|
// trans.verify_pw1_user(b"123456").expect("verify p1 user pin");
|
|
// trans.verify_pw1_sign(b"123456").expect("verify p1 sign pin");
|
|
// trans.verify_pw3(b"12345678").expect("verify p3 pin");
|
|
|
|
// let open = Open::new(pgp.transaction()?)?;
|
|
|
|
// println!(" {}", open.application_identifier()?.ident());
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
|