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<'_, '_>
Sourcepub fn public_key(&self) -> &PublicKey
pub fn public_key(&self) -> &PublicKey
The OpenPGP public key material that corresponds to the key in this CardSlot
pub fn decrypt( &self, values: &PkeskBytes, ) -> Result<(Vec<u8>, SymmetricKeyAlgorithm)>
pub fn decrypt_message(&self, message: &Message) -> Result<Message, Error>
Trait Implementations§
Source§impl PublicKeyTrait for CardSlot<'_, '_>
impl PublicKeyTrait for CardSlot<'_, '_>
fn version(&self) -> KeyVersion
fn fingerprint(&self) -> Fingerprint
fn algorithm(&self) -> PublicKeyAlgorithm
fn created_at(&self) -> &DateTime<Utc>
fn expiration(&self) -> Option<u16>
Source§fn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &SignatureBytes,
) -> Result<()>
fn verify_signature( &self, hash: HashAlgorithm, data: &[u8], sig: &SignatureBytes, ) -> Result<()>
Verify a signed message.
Data will be hashed using
hash
, before verifying.Source§fn encrypt<R: CryptoRng + Rng>(
&self,
rng: R,
plain: &[u8],
typ: EskType,
) -> Result<PkeskBytes>
fn encrypt<R: CryptoRng + Rng>( &self, rng: R, plain: &[u8], typ: EskType, ) -> Result<PkeskBytes>
Encrypt the given
plain
for this key.Source§fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>
fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>
This is the data used for hashing in a signature. Only uses the public portion of the key.
fn public_params(&self) -> &PublicParams
fn is_signing_key(&self) -> bool
fn is_encryption_key(&self) -> bool
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<SignatureBytes>
fn public_key(&self) -> Self::PublicKey
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