#[non_exhaustive]pub enum Ciphertext {
RSA {
c: MPI,
},
ElGamal {
e: MPI,
c: MPI,
},
ECDH {
e: MPI,
key: Box<[u8]>,
},
X25519 {
e: Box<[u8; 32]>,
key: Box<[u8]>,
},
X448 {
e: Box<[u8; 56]>,
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.
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.
X25519
X25519 ciphertext.
X448
X448 ciphertext.
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 9580 for details.
Trait Implementations§
Source§impl Clone for Ciphertext
impl Clone for Ciphertext
Source§fn clone(&self) -> Ciphertext
fn clone(&self) -> Ciphertext
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const 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§impl PartialOrd for Ciphertext
impl PartialOrd for Ciphertext
impl 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