openpgp-card/card-functionality/src/list-cards.rs
2022-10-28 18:55:42 +02:00

18 lines
521 B
Rust

// SPDX-FileCopyrightText: 2021 Heiko Schaefer <heiko@schaefer.name>
// SPDX-License-Identifier: MIT OR Apache-2.0
use anyhow::Result;
use openpgp_card_pcsc::PcscBackend;
use openpgp_card_sequoia::{state::Open, Card};
fn main() -> Result<()> {
println!("The following OpenPGP cards are connected to your system:");
for backend in PcscBackend::cards(None)? {
let mut card: Card<Open> = backend.into();
println!(" {}", card.transaction()?.application_identifier()?.ident());
}
Ok(())
}