Enum sequoia_openpgp::packet::PKESK
source · [−]#[non_exhaustive]
pub enum PKESK {
V3(PKESK3),
}
Expand description
Holds an asymmetrically encrypted session key.
The session key is used to decrypt the actual ciphertext, which is typically stored in a SEIP or AED packet. See Section 5.1 of RFC 4880 for details.
A PKESK packet is not normally instantiated directly. In most
cases, you’ll create one as a side-effect of encrypting a message
using the streaming serializer, or parsing an encrypted message
using the PacketParser
.
Note: This enum cannot be exhaustively matched to allow future extensions.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
V3(PKESK3)
PKESK packet version 3.
Implementations
Methods from Deref<Target = PKESK3>
sourcepub fn set_recipient(&mut self, recipient: KeyID) -> KeyID
pub fn set_recipient(&mut self, recipient: KeyID) -> KeyID
Sets the recipient.
sourcepub fn pk_algo(&self) -> PublicKeyAlgorithm
pub fn pk_algo(&self) -> PublicKeyAlgorithm
Gets the public key algorithm.
sourcepub fn set_pk_algo(&mut self, algo: PublicKeyAlgorithm) -> PublicKeyAlgorithm
pub fn set_pk_algo(&mut self, algo: PublicKeyAlgorithm) -> PublicKeyAlgorithm
Sets the public key algorithm.
sourcepub fn esk(&self) -> &Ciphertext
pub fn esk(&self) -> &Ciphertext
Gets the encrypted session key.
sourcepub fn set_esk(&mut self, esk: Ciphertext) -> Ciphertext
pub fn set_esk(&mut self, esk: Ciphertext) -> Ciphertext
Sets the encrypted session key.
sourcepub fn decrypt(
&self,
decryptor: &mut dyn Decryptor,
sym_algo_hint: Option<SymmetricAlgorithm>
) -> Option<(SymmetricAlgorithm, SessionKey)>
pub fn decrypt(
&self,
decryptor: &mut dyn Decryptor,
sym_algo_hint: Option<SymmetricAlgorithm>
) -> Option<(SymmetricAlgorithm, SessionKey)>
Decrypts the encrypted session key.
If the symmetric algorithm used to encrypt the message is known in advance, it should be given as argument. This allows us to reduce the side-channel leakage of the decryption operation for RSA.
Returns the session key and symmetric algorithm used to encrypt the following payload.
Returns None
on errors. This prevents leaking information
to an attacker, which could lead to compromise of secret key
material with certain algorithms (RSA). See Section 14 of
RFC 4880.
Trait Implementations
sourceimpl Any<PKESK> for Packet
impl Any<PKESK> for Packet
sourcefn downcast(self) -> Result<PKESK, Packet>
fn downcast(self) -> Result<PKESK, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&PKESK>
fn downcast_ref(&self) -> Option<&PKESK>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut PKESK>
fn downcast_mut(&mut self) -> Option<&mut PKESK>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl IntoIterator for PKESK
impl IntoIterator for PKESK
Implement IntoIterator
so that
cert::insert_packets(sig)
just works.
sourceimpl MarshalInto for PKESK
impl MarshalInto for PKESK
sourcefn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Computes the maximal length of the serialized representation. Read more
sourcefn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serializes into the given buffer. Read more
sourceimpl<'a> Parse<'a, PKESK> for PKESK
impl<'a> Parse<'a, PKESK> for PKESK
impl Eq for PKESK
impl StructuralEq for PKESK
impl StructuralPartialEq for PKESK
Auto Trait Implementations
impl RefUnwindSafe for PKESK
impl Send for PKESK
impl Sync for PKESK
impl Unpin for PKESK
impl UnwindSafe for PKESK
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more