feat: init commit

This commit is contained in:
2022-03-27 22:11:36 +08:00
parent d2b101a02b
commit cf044ba7d0
6 changed files with 1792 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
target/
.idea/

1747
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

14
Cargo.toml Normal file
View File

@@ -0,0 +1,14 @@
[package]
name = "openpgp-card-test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.56"
openpgp-card = "0.2.2"
openpgp-card-pcsc = "0.2.1"
openpgp-card-sequoia = "0.0.8"
openpgp-card-scdc = "0.2.1"

18
examples/list_cards.rs Normal file
View File

@@ -0,0 +1,18 @@
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());
}
Ok(())
}

8
justfile Normal file
View File

@@ -0,0 +1,8 @@
_:
@just --list
# example list cards
example_list_cards:
cargo run --example list_cards

3
src/main.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}