Trait sequoia_openpgp::crypto::Decryptor

source ·
pub trait Decryptor {
    // Required methods
    fn public(&self) -> &Key<PublicParts, UnspecifiedRole>;
    fn decrypt(
        &mut self,
        ciphertext: &Ciphertext,
        plaintext_len: Option<usize>,
    ) -> Result<SessionKey>;
}
Expand description

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:

Required Methods§

source

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>

Decrypts ciphertext, returning the plain session key.

Trait Implementations§

source§

impl Decryptor for Box<dyn Decryptor>

source§

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>

Decrypts ciphertext, returning the plain session key.
source§

impl Decryptor for Box<dyn Decryptor + Send + Sync>

source§

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>

Decrypts ciphertext, returning the plain session key.

Implementations on Foreign Types§

source§

impl Decryptor for Box<dyn Decryptor + Send + Sync>

source§

fn public(&self) -> &Key<PublicParts, UnspecifiedRole>

source§

fn decrypt( &mut self, ciphertext: &Ciphertext, plaintext_len: Option<usize>, ) -> Result<SessionKey>

source§

impl Decryptor for Box<dyn Decryptor>

source§

fn public(&self) -> &Key<PublicParts, UnspecifiedRole>

source§

fn decrypt( &mut self, ciphertext: &Ciphertext, plaintext_len: Option<usize>, ) -> Result<SessionKey>

Implementors§