Add "list-cards" tool.

This commit is contained in:
Heiko Schaefer 2021-10-08 00:51:01 +02:00
parent a4c04de09c
commit 73593e66e7
2 changed files with 22 additions and 0 deletions

View file

@ -23,6 +23,10 @@ path = "src/keygen.rs"
name = "other" name = "other"
path = "src/other.rs" path = "src/other.rs"
[[bin]]
name = "list-cards"
path = "src/list-cards.rs"
[dependencies] [dependencies]
openpgp-card = { path = "../openpgp-card" } openpgp-card = { path = "../openpgp-card" }
openpgp-card-sequoia = { path = "../openpgp-card-sequoia" } openpgp-card-sequoia = { path = "../openpgp-card-sequoia" }

View file

@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: 2021 Heiko Schaefer <heiko@schaefer.name>
// SPDX-License-Identifier: MIT OR Apache-2.0
use anyhow::Result;
use openpgp_card_pcsc::PcscClient;
use openpgp_card_sequoia::card::Open;
fn main() -> Result<()> {
println!("The following OpenPGP cards are connected to your system:");
for card in PcscClient::cards()? {
let open = Open::open_card(card)?;
println!(" {}", open.application_identifier()?.ident());
}
Ok(())
}