Struct openpgp_card_rpgp::CardSlot
source · pub struct CardSlot<'cs, 't> { /* private fields */ }
Expand description
An individual OpenPGP card key slot, which can be used for private key operations.
Implementations§
source§impl<'cs, 't> CardSlot<'cs, 't>
impl<'cs, 't> CardSlot<'cs, 't>
sourcepub fn with_public_key(
tx: &'cs mut Card<Transaction<'t>>,
key_type: KeyType,
public_key: PublicKey,
touch_prompt: &'cs (dyn Fn() + Send + Sync),
) -> Result<Self, Error>
pub fn with_public_key( tx: &'cs mut Card<Transaction<'t>>, key_type: KeyType, public_key: PublicKey, touch_prompt: &'cs (dyn Fn() + Send + Sync), ) -> Result<Self, Error>
Set up a CardSigner for the card behind tx
, using the key slot for key_type
.
Initializes the CardSigner based on public key information obtained from public_key
.
sourcepub fn init_from_card(
tx: &'cs mut Card<Transaction<'t>>,
key_type: KeyType,
touch_prompt: &'cs (dyn Fn() + Send + Sync),
) -> Result<Self, Error>
pub fn init_from_card( tx: &'cs mut Card<Transaction<'t>>, key_type: KeyType, touch_prompt: &'cs (dyn Fn() + Send + Sync), ) -> Result<Self, Error>
Set up a CardSlot for the card behind tx
, using the key slot for key_type
.
Initializes the CardSigner based on public key information obtained from the card.
source§impl CardSlot<'_, '_>
impl CardSlot<'_, '_>
Trait Implementations§
source§impl PublicKeyTrait for CardSlot<'_, '_>
impl PublicKeyTrait for CardSlot<'_, '_>
source§fn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &[Mpi],
) -> Result<()>
fn verify_signature( &self, hash: HashAlgorithm, data: &[u8], sig: &[Mpi], ) -> Result<()>
Verify a signed message.
Data will be hashed using
hash
, before verifying.source§impl SecretKeyTrait for CardSlot<'_, '_>
impl SecretKeyTrait for CardSlot<'_, '_>
type PublicKey = PublicKey
source§fn unlock<F, G, T>(&self, _pw: F, work: G) -> Result<T>
fn unlock<F, G, T>(&self, _pw: F, work: G) -> Result<T>
Unlock the raw data in the secret parameters.
fn create_signature<F>( &self, _key_pw: F, hash: HashAlgorithm, data: &[u8], ) -> Result<Vec<Mpi>>
fn public_key(&self) -> Self::PublicKey
fn public_params(&self) -> &PublicParams
source§fn hash_alg(&self) -> HashAlgorithm
fn hash_alg(&self) -> HashAlgorithm
The suggested hash algorithm to calculate the signature hash digest with, when using this
key as a signer
Auto Trait Implementations§
impl<'cs, 't> !Freeze for CardSlot<'cs, 't>
impl<'cs, 't> !RefUnwindSafe for CardSlot<'cs, 't>
impl<'cs, 't> Send for CardSlot<'cs, 't>
impl<'cs, 't> Sync for CardSlot<'cs, 't>
impl<'cs, 't> Unpin for CardSlot<'cs, 't>
impl<'cs, 't> !UnwindSafe for CardSlot<'cs, 't>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more