From 8d5b1c05636802f32dd445708390924acd8d7a73 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Sat, 26 Aug 2023 16:47:14 +0200 Subject: [PATCH] openpgp-card-example: adjust to card-backend refactor --- Cargo.toml | 2 +- openpgp-card-examples/Cargo.toml | 2 +- openpgp-card-examples/src/bin/decrypt.rs | 6 +++--- openpgp-card-examples/src/bin/detach-sign.rs | 6 +++--- openpgp-card-sequoia/Cargo.toml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b393d62..9d71b56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,6 @@ members = [ "card-backend", "pcsc", "scdc", -# "openpgp-card-examples", + "openpgp-card-examples", # "card-functionality", ] diff --git a/openpgp-card-examples/Cargo.toml b/openpgp-card-examples/Cargo.toml index 5588278..aa3fc1e 100644 --- a/openpgp-card-examples/Cargo.toml +++ b/openpgp-card-examples/Cargo.toml @@ -14,7 +14,7 @@ documentation = "https://docs.rs/crate/openpgp-card-examples" [dependencies] sequoia-openpgp = "1.3" nettle = "7" -openpgp-card-pcsc = { path = "../pcsc" } +card-backend-pcsc = { path = "../pcsc" } openpgp-card-sequoia = { path = "../openpgp-card-sequoia" } chrono = "0.4" anyhow = "1" diff --git a/openpgp-card-examples/src/bin/decrypt.rs b/openpgp-card-examples/src/bin/decrypt.rs index 5119dfc..a0d5910 100644 --- a/openpgp-card-examples/src/bin/decrypt.rs +++ b/openpgp-card-examples/src/bin/decrypt.rs @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2021 Wiktor Kwapisiewicz // SPDX-License-Identifier: MIT OR Apache-2.0 -use openpgp_card_pcsc::PcscBackend; +use card_backend_pcsc::PcscBackend; use openpgp_card_sequoia::{state::Open, Card}; use sequoia_openpgp::parse::{stream::DecryptorBuilder, Parse}; use sequoia_openpgp::policy::StandardPolicy; @@ -17,9 +17,9 @@ fn main() -> Result<(), Box> { let card_ident = &args[0]; let pin_file = &args[1]; - let backend = PcscBackend::open_by_ident(card_ident, None)?; + let cards = PcscBackend::card_backends(None)?; - let mut card: Card = backend.into(); + let mut card: Card = Card::::open_by_ident(cards, card_ident)?; let mut transaction = card.transaction()?; let pin = std::fs::read(pin_file)?; diff --git a/openpgp-card-examples/src/bin/detach-sign.rs b/openpgp-card-examples/src/bin/detach-sign.rs index 4cc87f8..f0acc11 100644 --- a/openpgp-card-examples/src/bin/detach-sign.rs +++ b/openpgp-card-examples/src/bin/detach-sign.rs @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2021 Wiktor Kwapisiewicz // SPDX-License-Identifier: MIT OR Apache-2.0 -use openpgp_card_pcsc::PcscBackend; +use card_backend_pcsc::PcscBackend; use openpgp_card_sequoia::{state::Open, Card}; use sequoia_openpgp::serialize::stream::{Armorer, Message, Signer}; @@ -16,9 +16,9 @@ fn main() -> Result<(), Box> { let card_ident = &args[0]; let pin_file = &args[1]; - let backend = PcscBackend::open_by_ident(card_ident, None)?; + let cards = PcscBackend::card_backends(None)?; - let mut card: Card = backend.into(); + let mut card: Card = Card::::open_by_ident(cards, card_ident)?; let mut transaction = card.transaction()?; let pin = std::fs::read(pin_file)?; diff --git a/openpgp-card-sequoia/Cargo.toml b/openpgp-card-sequoia/Cargo.toml index fdccf11..73027c7 100644 --- a/openpgp-card-sequoia/Cargo.toml +++ b/openpgp-card-sequoia/Cargo.toml @@ -5,7 +5,7 @@ name = "openpgp-card-sequoia" description = "Wrapper of openpgp-card for use with Sequoia PGP" license = "MIT OR Apache-2.0" -version = "0.2.0-pre" +version = "0.2.0" authors = ["Heiko Schaefer "] edition = "2018" repository = "https://gitlab.com/openpgp-card/openpgp-card"