Trait sequoia_openpgp::crypto::Decryptor [−][src]
pub trait Decryptor { fn public(&self) -> &Key<PublicParts, UnspecifiedRole>; fn decrypt(
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>; }
Decrypts a message.
Used by PKESK::decrypt
to decrypt session keys.
This is a low-level mechanism to decrypt an arbitrary OpenPGP ciphertext. Using this trait allows Sequoia to perform all operations involving decryption to use a variety of secret key storage mechanisms (e.g. smart cards).
A decryptor consists of the public key and a way of decrypting a
session key. This crate implements Decryptor
for KeyPair
,
which is a tuple containing the public and unencrypted secret key
in memory. Other crates may provide their own implementations of
Decryptor
to utilize keys stored in various places. Currently, the
following implementations exist:
KeyPair
: In-memory keys.sequoia_rpc::gnupg::KeyPair
: Connects to thegpg-agent
.
Required methods
fn public(&self) -> &Key<PublicParts, UnspecifiedRole>
[src]
Returns a reference to the public key.
fn decrypt(
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>
[src]
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>
Decrypts ciphertext
, returning the plain session key.
Implementors
impl Decryptor for KeyPair
[src]
impl Decryptor for KeyPair
[src]fn public(&self) -> &Key<PublicParts, UnspecifiedRole>
[src]
fn decrypt(
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>
[src]
&mut self,
ciphertext: &Ciphertext,
plaintext_len: Option<usize>
) -> Result<SessionKey>