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
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.
ElGamal
ElGamal ciphertext.
ECDH
Elliptic curve ElGamal public key.
Unknown
Unknown number of MPIs for an unknown algorithm.
Implementations§
source§impl Ciphertext
impl Ciphertext
sourcepub 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
sourcepub 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 moresource§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§fn cmp(&self, other: &Ciphertext) -> Ordering
fn cmp(&self, other: &Ciphertext) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for Ciphertext
impl PartialEq 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 ==
.source§impl PartialOrd for Ciphertext
impl PartialOrd for Ciphertext
source§fn partial_cmp(&self, other: &Ciphertext) -> Option<Ordering>
fn partial_cmp(&self, other: &Ciphertext) -> Option<Ordering>
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 moreimpl Eq for Ciphertext
impl StructuralPartialEq for Ciphertext
Auto Trait Implementations§
impl Freeze for Ciphertext
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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)