[][src]Enum sequoia_openpgp::crypto::mpi::Ciphertext

#[non_exhaustive]pub enum Ciphertext {
    RSA {
        c: MPI,
    },
    ElGamal {
        e: MPI,
        c: MPI,
    },
    ECDH {
        e: MPI,
        key: Box<[u8]>,
    },
    Unknown {
        mpis: Box<[MPI]>,
        rest: Box<[u8]>,
    },
}

An encrypted session key.

Provides a typed and structured way of storing multiple MPIs in PKESK packets.

Note: This enum cannot be exhaustively matched to allow future extensions.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
RSA

RSA ciphertext.

Fields of RSA

c: MPI

m^e mod N.

ElGamal

ElGamal ciphertext.

Fields of ElGamal

e: MPI

Ephemeral key.

c: MPI

.

ECDH

Elliptic curve ElGamal public key.

Fields of ECDH

e: MPI

Ephemeral key.

key: Box<[u8]>

Symmetrically encrypted session key.

Unknown

Unknown number of MPIs for an unknown algorithm.

Fields of Unknown

mpis: Box<[MPI]>

The successfully parsed MPIs.

rest: Box<[u8]>

Any data that failed to parse.

Implementations

impl Ciphertext[src]

pub fn pk_algo(&self) -> Option<PublicKeyAlgorithm>[src]

Returns, if known, the public-key algorithm for this ciphertext.

impl Ciphertext[src]

pub fn parse<R: Read + Send + Sync>(
    algo: PublicKeyAlgorithm,
    reader: R
) -> Result<Self>
[src]

Parses a set of OpenPGP MPIs representing a ciphertext.

Expects MPIs for a public key algorithm algos ciphertext. See Section 3.2 of RFC 4880 for details.

Trait Implementations

impl Clone for Ciphertext[src]

impl Debug for Ciphertext[src]

impl Eq for Ciphertext[src]

impl Hash for Ciphertext[src]

impl Hash for Ciphertext[src]

impl Marshal for Ciphertext[src]

impl MarshalInto for Ciphertext[src]

impl Ord for Ciphertext[src]

impl PartialEq<Ciphertext> for Ciphertext[src]

impl PartialOrd<Ciphertext> for Ciphertext[src]

impl StructuralEq for Ciphertext[src]

impl StructuralPartialEq for Ciphertext[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.