pub struct Decryptor<'key, 'prompt> { /* private fields */ }Expand description
A decryptor for a PKCS#11 key.
This implements sequoia_openpgp::crypto::Decryptor and hence can
be used wherever a Sequoia method needs to decrypt data.
Implementations§
Source§impl<'key, 'prompt> Decryptor<'key, 'prompt>
impl<'key, 'prompt> Decryptor<'key, 'prompt>
Sourcepub fn new<P>(
prompt: P,
key: &'key Key,
user_pin: Option<AuthPin>,
) -> Result<Self>where
P: Prompt + 'prompt,
pub fn new<P>(
prompt: P,
key: &'key Key,
user_pin: Option<AuthPin>,
) -> Result<Self>where
P: Prompt + 'prompt,
Creates a Decryptor.
This is a bit ugly, because we can’t stash a PKCS#11
Session: a struct that implements Decryptor has to
implement Sync, but a Session is not Sync.
If the user PIN is known, pass it through to avoid prompting
the user. (If user_pin is wrong, we don’t prompt the user,
but immediately return an error.) Otherwise, the user is
prompted.
Trait Implementations§
Source§impl Decryptor for Decryptor<'_, '_>
impl Decryptor for Decryptor<'_, '_>
Source§fn public(&self) -> &Key<PublicParts, UnspecifiedRole>
fn public(&self) -> &Key<PublicParts, UnspecifiedRole>
Returns a reference to the public key.
Source§fn decrypt(
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>,
) -> Result<SessionKey>
fn decrypt( &mut self, ciphertext: &Ciphertext, plaintext_len: Option<usize>, ) -> Result<SessionKey>
Decrypts
ciphertext, returning the plain session key.Auto Trait Implementations§
impl<'key, 'prompt> !Freeze for Decryptor<'key, 'prompt>
impl<'key, 'prompt> !RefUnwindSafe for Decryptor<'key, 'prompt>
impl<'key, 'prompt> !UnwindSafe for Decryptor<'key, 'prompt>
impl<'key, 'prompt> Send for Decryptor<'key, 'prompt>
impl<'key, 'prompt> Sync for Decryptor<'key, 'prompt>
impl<'key, 'prompt> Unpin for Decryptor<'key, 'prompt>
impl<'key, 'prompt> UnsafeUnpin for Decryptor<'key, 'prompt>
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