diff --git a/openpgp-card-sequoia/src/lib.rs b/openpgp-card-sequoia/src/lib.rs index 2d185cf..28eb753 100644 --- a/openpgp-card-sequoia/src/lib.rs +++ b/openpgp-card-sequoia/src/lib.rs @@ -16,9 +16,8 @@ //! use openpgp_card_sequoia::card::Open; //! //! # fn main() -> Result<(), Box> { -//! for card in PcscClient::cards()? { -//! let mut ca = card.into(); -//! let open = Open::new(&mut ca)?; +//! for mut cc in PcscClient::cards()? { +//! let open = Open::new(&mut cc)?; //! println!("Found OpenPGP card with ident '{}'", //! open.application_identifier()?.ident()); //! } @@ -33,8 +32,8 @@ //! use openpgp_card_sequoia::card::Open; //! //! # fn main() -> Result<(), Box> { -//! let mut ca = PcscClient::open_by_ident("abcd:12345678")?.into(); -//! let mut open = Open::new(&mut ca)?; +//! let mut cc = PcscClient::open_by_ident("abcd:12345678")?; +//! let mut open = Open::new(&mut cc)?; //! # Ok(()) //! # } //! ``` @@ -55,8 +54,8 @@ //! # fn main() -> Result<(), Box> { //! // Open card via PCSC //! use sequoia_openpgp::policy::StandardPolicy; -//! let mut ca = PcscClient::open_by_ident("abcd:12345678")?.into(); -//! let mut open = Open::new(&mut ca)?; +//! let mut cc = PcscClient::open_by_ident("abcd:12345678")?; +//! let mut open = Open::new(&mut cc)?; //! //! // Get authorization for user access to the card with password //! open.verify_user("123456")?; @@ -96,8 +95,8 @@ //! # fn main() -> Result<(), Box> { //! // Open card via PCSC //! use sequoia_openpgp::policy::StandardPolicy; -//! let mut ca = PcscClient::open_by_ident("abcd:12345678")?.into(); -//! let mut open = Open::new(&mut ca)?; +//! let mut cc = PcscClient::open_by_ident("abcd:12345678")?; +//! let mut open = Open::new(&mut cc)?; //! //! // Get authorization for signing access to the card with password //! open.verify_user_for_signing("123456")?; @@ -126,8 +125,8 @@ //! //! # fn main() -> Result<(), Box> { //! // Open card via PCSC -//! let mut ca = PcscClient::open_by_ident("abcd:12345678")?.into(); -//! let mut open = Open::new(&mut ca)?; +//! let mut cc = PcscClient::open_by_ident("abcd:12345678")?; +//! let mut open = Open::new(&mut cc)?; //! //! // Get authorization for admin access to the card with password //! open.verify_admin("12345678")?; diff --git a/tools/src/bin/opgpcard-pin/main.rs b/tools/src/bin/opgpcard-pin/main.rs index 3abf213..10ade1b 100644 --- a/tools/src/bin/opgpcard-pin/main.rs +++ b/tools/src/bin/opgpcard-pin/main.rs @@ -4,7 +4,7 @@ use anyhow::Result; use structopt::StructOpt; -use openpgp_card::{Error, StatusBytes}; +use openpgp_card::{CardClient, Error, StatusBytes}; use openpgp_card_pcsc::PcscClient; use openpgp_card_sequoia::card::Open; diff --git a/tools/src/bin/opgpcard/main.rs b/tools/src/bin/opgpcard/main.rs index 8c2024e..1d32ceb 100644 --- a/tools/src/bin/opgpcard/main.rs +++ b/tools/src/bin/opgpcard/main.rs @@ -11,12 +11,13 @@ use sequoia_openpgp::serialize::stream::{Armorer, Message, Signer}; use sequoia_openpgp::serialize::SerializeInto; use sequoia_openpgp::Cert; +use openpgp_card::algorithm::AlgoSimple; +use openpgp_card::{card_do::Sex, CardApp, KeyType}; + use openpgp_card_sequoia::card::{Admin, Open}; use openpgp_card_sequoia::util::{make_cert, public_key_material_to_key}; use openpgp_card_sequoia::{sq_util, PublicKey}; -use openpgp_card::algorithm::AlgoSimple; -use openpgp_card::{card_do::Sex, KeyType}; use std::io::Write; mod cli; @@ -150,7 +151,7 @@ fn set_identity( ) -> Result<(), Box> { let mut card = util::open_card(ident)?; - card.set_identity(id)?; + CardApp::set_identity(&mut card, id)?; Ok(()) } diff --git a/tools/src/bin/opgpcard/util.rs b/tools/src/bin/opgpcard/util.rs index cfe547f..cb5545d 100644 --- a/tools/src/bin/opgpcard/util.rs +++ b/tools/src/bin/opgpcard/util.rs @@ -4,15 +4,15 @@ use anyhow::{anyhow, Context, Result}; use std::path::{Path, PathBuf}; -use openpgp_card::{CardApp, Error}; +use openpgp_card::Error; use openpgp_card_pcsc::PcscClient; use openpgp_card_sequoia::card::{Admin, Open, Sign, User}; -pub(crate) fn cards() -> Result, Error> { +pub(crate) fn cards() -> Result, Error> { PcscClient::cards() } -pub(crate) fn open_card(ident: &str) -> Result { +pub(crate) fn open_card(ident: &str) -> Result { PcscClient::open_by_ident(ident) }