Add "list-cards" tool.
This commit is contained in:
parent
a4c04de09c
commit
73593e66e7
2 changed files with 22 additions and 0 deletions
|
@ -23,6 +23,10 @@ path = "src/keygen.rs"
|
|||
name = "other"
|
||||
path = "src/other.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "list-cards"
|
||||
path = "src/list-cards.rs"
|
||||
|
||||
[dependencies]
|
||||
openpgp-card = { path = "../openpgp-card" }
|
||||
openpgp-card-sequoia = { path = "../openpgp-card-sequoia" }
|
||||
|
|
18
card-functionality/src/list-cards.rs
Normal file
18
card-functionality/src/list-cards.rs
Normal 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(())
|
||||
}
|
Loading…
Reference in a new issue