# Enum sequoia_openpgp::crypto::mpi::Ciphertext

source · [−]```
#[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]>,
},
}
```

## Expand description

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)

## This enum is marked as non-exhaustive

`RSA`

#### Fields

`c: MPI`

m^e mod N.

RSA ciphertext.

`ElGamal`

ElGamal ciphertext.

`ECDH`

Elliptic curve ElGamal public key.

`Unknown`

Unknown number of MPIs for an unknown algorithm.

## Implementations

source### impl Ciphertext

### impl Ciphertext

source#### pub fn pk_algo(&self) -> Option<PublicKeyAlgorithm>

#### pub fn pk_algo(&self) -> Option<PublicKeyAlgorithm>

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

source### impl Ciphertext

### impl Ciphertext

source#### pub fn parse<R: Read + Send + Sync>(

algo: PublicKeyAlgorithm,

reader: R

) -> Result<Self>

#### pub fn parse<R: Read + Send + Sync>(

algo: PublicKeyAlgorithm,

reader: R

) -> Result<Self>

Parses a set of OpenPGP MPIs representing a ciphertext.

Expects MPIs for a public key algorithm `algo`

s ciphertext.
See Section 3.2 of RFC 4880 for details.

## Trait Implementations

source### impl Clone for Ciphertext

### impl Clone for Ciphertext

source#### fn clone(&self) -> Ciphertext

#### fn clone(&self) -> Ciphertext

Returns a copy of the value. Read more

1.0.0 · source#### fn clone_from(&mut self, source: &Self)

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`

. Read more

source### impl Debug for Ciphertext

### impl Debug for Ciphertext

source### impl Hash for Ciphertext

### impl Hash for Ciphertext

source### impl Hash for Ciphertext

### impl Hash for Ciphertext

source### impl Marshal for Ciphertext

### impl Marshal for Ciphertext

source### impl MarshalInto for Ciphertext

### impl MarshalInto for Ciphertext

source#### fn serialized_len(&self) -> usize

#### fn serialized_len(&self) -> usize

Computes the maximal length of the serialized representation. Read more

source#### fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>

#### fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>

Serializes into the given buffer. Read more

source### impl Ord for Ciphertext

### impl Ord for Ciphertext

source### impl PartialEq<Ciphertext> for Ciphertext

### impl PartialEq<Ciphertext> for Ciphertext

source#### fn eq(&self, other: &Ciphertext) -> bool

#### fn eq(&self, other: &Ciphertext) -> bool

This method tests for `self`

and `other`

values to be equal, and is used
by `==`

. Read more

source#### fn ne(&self, other: &Ciphertext) -> bool

#### fn ne(&self, other: &Ciphertext) -> bool

This method tests for `!=`

.

source### impl PartialOrd<Ciphertext> for Ciphertext

### impl PartialOrd<Ciphertext> for Ciphertext

source#### fn partial_cmp(&self, other: &Ciphertext) -> Option<Ordering>

#### fn partial_cmp(&self, other: &Ciphertext) -> Option<Ordering>

This method returns an ordering between `self`

and `other`

values if one exists. Read more

1.0.0 · source#### fn lt(&self, other: &Rhs) -> bool

#### fn lt(&self, other: &Rhs) -> bool

This method tests less than (for `self`

and `other`

) and is used by the `<`

operator. Read more

1.0.0 · source#### fn le(&self, other: &Rhs) -> bool

#### fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for `self`

and `other`

) and is used by the `<=`

operator. Read more

### impl Eq for Ciphertext

### impl StructuralEq for Ciphertext

### impl StructuralPartialEq for Ciphertext

## Auto Trait Implementations

### impl RefUnwindSafe for Ciphertext

### impl Send for Ciphertext

### impl Sync for Ciphertext

### impl Unpin for Ciphertext

### impl UnwindSafe for Ciphertext

## Blanket Implementations

source### impl<T> BorrowMut<T> for T where

T: ?Sized,

### impl<T> BorrowMut<T> for T where

T: ?Sized,

const: unstable · source#### fn borrow_mut(&mut self) -> &mut T

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more