Enum sequoia_openpgp::Packet
source · [−]#[non_exhaustive]
pub enum Packet {
Show 18 variants
Unknown(Unknown),
Signature(Signature),
OnePassSig(OnePassSig),
PublicKey(Key<PublicParts, PrimaryRole>),
PublicSubkey(Key<PublicParts, SubordinateRole>),
SecretKey(Key<SecretParts, PrimaryRole>),
SecretSubkey(Key<SecretParts, SubordinateRole>),
Marker(Marker),
Trust(Trust),
UserID(UserID),
UserAttribute(UserAttribute),
Literal(Literal),
CompressedData(CompressedData),
PKESK(PKESK),
SKESK(SKESK),
SEIP(SEIP),
MDC(MDC),
AED(AED),
}
Expand description
Enumeration of packet types.
The different OpenPGP packets are detailed in Section 5 of RFC 4880.
The Unknown
packet allows Sequoia to deal with packets that it
doesn’t understand. It is basically a binary blob that includes
the packet’s tag. See the module-level documentation for
details.
Note: This enum cannot be exhaustively matched to allow future extensions.
A note on equality
We define equality on Packet
as the equality of the serialized
form of their packet bodies as defined by RFC 4880. That is, two
packets are considered equal if and only if their serialized forms
are equal, modulo the OpenPGP framing (CTB
and length style,
potential partial body encoding).
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Unknown(Unknown)
Unknown packet.
Signature(Signature)
Signature packet.
OnePassSig(OnePassSig)
One pass signature packet.
PublicKey(Key<PublicParts, PrimaryRole>)
Public key packet.
PublicSubkey(Key<PublicParts, SubordinateRole>)
Public subkey packet.
SecretKey(Key<SecretParts, PrimaryRole>)
Public/Secret key pair.
SecretSubkey(Key<SecretParts, SubordinateRole>)
Public/Secret subkey pair.
Marker(Marker)
Marker packet.
Trust(Trust)
Trust packet.
UserID(UserID)
User ID packet.
UserAttribute(UserAttribute)
User attribute packet.
Literal(Literal)
Literal data packet.
CompressedData(CompressedData)
Compressed literal data packet.
PKESK(PKESK)
Public key encrypted data packet.
SKESK(SKESK)
Symmetric key encrypted data packet.
SEIP(SEIP)
Symmetric key encrypted, integrity protected data packet.
MDC(MDC)
Modification detection code packet.
AED(AED)
AEAD Encrypted Data Packet.
Implementations
sourceimpl Packet
impl Packet
sourcepub fn tag(&self) -> Tag
pub fn tag(&self) -> Tag
Returns the Packet's
corresponding OpenPGP tag.
Tags are explained in Section 4.3 of RFC 4880.
sourcepub fn kind(&self) -> Option<Tag>
pub fn kind(&self) -> Option<Tag>
Returns the parsed Packet's
corresponding OpenPGP tag.
Returns the packets tag, but only if it was successfully
parsed into the corresponding packet type. If e.g. a
Signature Packet uses some unsupported methods, it is parsed
into an Packet::Unknown
. tag()
returns Tag::Signature
,
whereas kind()
returns None
.
sourcepub fn version(&self) -> Option<u8>
pub fn version(&self) -> Option<u8>
Returns the Packet's
version, if the packet is versioned and
recognized.
If the packet is not versioned, or we couldn’t parse the
packet, this function returns None
.
sourcepub fn normalized_hash<H>(&self, state: &mut H) where
H: Hasher,
pub fn normalized_hash<H>(&self, state: &mut H) where
H: Hasher,
Hashes most everything into state.
This is an alternate implementation of Hash
, which does
not hash:
- The unhashed subpacket area of Signature packets.
- Secret key material.
Unlike Signature::normalize
, this method ignores
authenticated packets in the unhashed subpacket area.
Trait Implementations
sourceimpl Any<AED> for Packet
impl Any<AED> for Packet
sourcefn downcast(self) -> Result<AED, Packet>
fn downcast(self) -> Result<AED, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&AED>
fn downcast_ref(&self) -> Option<&AED>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut AED>
fn downcast_mut(&mut self) -> Option<&mut AED>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<CompressedData> for Packet
impl Any<CompressedData> for Packet
sourcefn downcast(self) -> Result<CompressedData, Packet>
fn downcast(self) -> Result<CompressedData, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&CompressedData>
fn downcast_ref(&self) -> Option<&CompressedData>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut CompressedData>
fn downcast_mut(&mut self) -> Option<&mut CompressedData>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Key<PublicParts, PrimaryRole>> for Packet
impl Any<Key<PublicParts, PrimaryRole>> for Packet
sourcefn downcast(self) -> Result<Key<PublicParts, PrimaryRole>, Packet>
fn downcast(self) -> Result<Key<PublicParts, PrimaryRole>, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Key<PublicParts, PrimaryRole>>
fn downcast_ref(&self) -> Option<&Key<PublicParts, PrimaryRole>>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, PrimaryRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, PrimaryRole>>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Key<PublicParts, SubordinateRole>> for Packet
impl Any<Key<PublicParts, SubordinateRole>> for Packet
sourcefn downcast(self) -> Result<Key<PublicParts, SubordinateRole>, Packet>
fn downcast(self) -> Result<Key<PublicParts, SubordinateRole>, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Key<PublicParts, SubordinateRole>>
fn downcast_ref(&self) -> Option<&Key<PublicParts, SubordinateRole>>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, SubordinateRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, SubordinateRole>>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Key<SecretParts, PrimaryRole>> for Packet
impl Any<Key<SecretParts, PrimaryRole>> for Packet
sourcefn downcast(self) -> Result<Key<SecretParts, PrimaryRole>, Packet>
fn downcast(self) -> Result<Key<SecretParts, PrimaryRole>, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Key<SecretParts, PrimaryRole>>
fn downcast_ref(&self) -> Option<&Key<SecretParts, PrimaryRole>>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, PrimaryRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, PrimaryRole>>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Key<SecretParts, SubordinateRole>> for Packet
impl Any<Key<SecretParts, SubordinateRole>> for Packet
sourcefn downcast(self) -> Result<Key<SecretParts, SubordinateRole>, Packet>
fn downcast(self) -> Result<Key<SecretParts, SubordinateRole>, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Key<SecretParts, SubordinateRole>>
fn downcast_ref(&self) -> Option<&Key<SecretParts, SubordinateRole>>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, SubordinateRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, SubordinateRole>>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Literal> for Packet
impl Any<Literal> for Packet
sourcefn downcast(self) -> Result<Literal, Packet>
fn downcast(self) -> Result<Literal, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Literal>
fn downcast_ref(&self) -> Option<&Literal>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Literal>
fn downcast_mut(&mut self) -> Option<&mut Literal>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<MDC> for Packet
impl Any<MDC> for Packet
sourcefn downcast(self) -> Result<MDC, Packet>
fn downcast(self) -> Result<MDC, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&MDC>
fn downcast_ref(&self) -> Option<&MDC>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut MDC>
fn downcast_mut(&mut self) -> Option<&mut MDC>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Marker> for Packet
impl Any<Marker> for Packet
sourcefn downcast(self) -> Result<Marker, Packet>
fn downcast(self) -> Result<Marker, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Marker>
fn downcast_ref(&self) -> Option<&Marker>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Marker>
fn downcast_mut(&mut self) -> Option<&mut Marker>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<OnePassSig> for Packet
impl Any<OnePassSig> for Packet
sourcefn downcast(self) -> Result<OnePassSig, Packet>
fn downcast(self) -> Result<OnePassSig, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&OnePassSig>
fn downcast_ref(&self) -> Option<&OnePassSig>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut OnePassSig>
fn downcast_mut(&mut self) -> Option<&mut OnePassSig>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
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 Any<SEIP> for Packet
impl Any<SEIP> for Packet
sourcefn downcast(self) -> Result<SEIP, Packet>
fn downcast(self) -> Result<SEIP, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&SEIP>
fn downcast_ref(&self) -> Option<&SEIP>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut SEIP>
fn downcast_mut(&mut self) -> Option<&mut SEIP>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<SKESK> for Packet
impl Any<SKESK> for Packet
sourcefn downcast(self) -> Result<SKESK, Packet>
fn downcast(self) -> Result<SKESK, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&SKESK>
fn downcast_ref(&self) -> Option<&SKESK>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut SKESK>
fn downcast_mut(&mut self) -> Option<&mut SKESK>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Signature> for Packet
impl Any<Signature> for Packet
sourcefn downcast(self) -> Result<Signature, Packet>
fn downcast(self) -> Result<Signature, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Signature>
fn downcast_ref(&self) -> Option<&Signature>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Signature>
fn downcast_mut(&mut self) -> Option<&mut Signature>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Trust> for Packet
impl Any<Trust> for Packet
sourcefn downcast(self) -> Result<Trust, Packet>
fn downcast(self) -> Result<Trust, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Trust>
fn downcast_ref(&self) -> Option<&Trust>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Trust>
fn downcast_mut(&mut self) -> Option<&mut Trust>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<Unknown> for Packet
impl Any<Unknown> for Packet
sourcefn downcast(self) -> Result<Unknown, Packet>
fn downcast(self) -> Result<Unknown, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&Unknown>
fn downcast_ref(&self) -> Option<&Unknown>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut Unknown>
fn downcast_mut(&mut self) -> Option<&mut Unknown>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<UserAttribute> for Packet
impl Any<UserAttribute> for Packet
sourcefn downcast(self) -> Result<UserAttribute, Packet>
fn downcast(self) -> Result<UserAttribute, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&UserAttribute>
fn downcast_ref(&self) -> Option<&UserAttribute>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut UserAttribute>
fn downcast_mut(&mut self) -> Option<&mut UserAttribute>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl Any<UserID> for Packet
impl Any<UserID> for Packet
sourcefn downcast(self) -> Result<UserID, Packet>
fn downcast(self) -> Result<UserID, Packet>
Attempts to downcast to T
, returning the packet if it fails. Read more
sourcefn downcast_ref(&self) -> Option<&UserID>
fn downcast_ref(&self) -> Option<&UserID>
Attempts to downcast to &T
, returning None
if it fails. Read more
sourcefn downcast_mut(&mut self) -> Option<&mut UserID>
fn downcast_mut(&mut self) -> Option<&mut UserID>
Attempts to downcast to &mut T
, returning None
if it fails. Read more
sourceimpl From<CompressedData> for Packet
impl From<CompressedData> for Packet
sourcefn from(s: CompressedData) -> Self
fn from(s: CompressedData) -> Self
Converts to this type from the input type.
sourceimpl From<Key<PublicParts, PrimaryRole>> for Packet
impl From<Key<PublicParts, PrimaryRole>> for Packet
sourcefn from(k: Key<PublicParts, PrimaryRole>) -> Self
fn from(k: Key<PublicParts, PrimaryRole>) -> Self
Convert the Key
struct to a Packet
.
sourceimpl From<Key<PublicParts, SubordinateRole>> for Packet
impl From<Key<PublicParts, SubordinateRole>> for Packet
sourcefn from(k: Key<PublicParts, SubordinateRole>) -> Self
fn from(k: Key<PublicParts, SubordinateRole>) -> Self
Convert the Key
struct to a Packet
.
sourceimpl From<Key<SecretParts, PrimaryRole>> for Packet
impl From<Key<SecretParts, PrimaryRole>> for Packet
sourcefn from(k: Key<SecretParts, PrimaryRole>) -> Self
fn from(k: Key<SecretParts, PrimaryRole>) -> Self
Convert the Key
struct to a Packet
.
sourceimpl From<Key<SecretParts, SubordinateRole>> for Packet
impl From<Key<SecretParts, SubordinateRole>> for Packet
sourcefn from(k: Key<SecretParts, SubordinateRole>) -> Self
fn from(k: Key<SecretParts, SubordinateRole>) -> Self
Convert the Key
struct to a Packet
.
sourceimpl From<OnePassSig> for Packet
impl From<OnePassSig> for Packet
sourcefn from(s: OnePassSig) -> Self
fn from(s: OnePassSig) -> Self
Converts to this type from the input type.
sourceimpl From<OnePassSig3> for Packet
impl From<OnePassSig3> for Packet
sourcefn from(p: OnePassSig3) -> Self
fn from(p: OnePassSig3) -> Self
Converts to this type from the input type.
sourceimpl From<Packet> for PacketPile
impl From<Packet> for PacketPile
sourceimpl From<Signature3> for Packet
impl From<Signature3> for Packet
sourcefn from(s: Signature3) -> Self
fn from(s: Signature3) -> Self
Converts to this type from the input type.
sourceimpl From<Signature4> for Packet
impl From<Signature4> for Packet
sourcefn from(s: Signature4) -> Self
fn from(s: Signature4) -> Self
Converts to this type from the input type.
sourceimpl From<UserAttribute> for Packet
impl From<UserAttribute> for Packet
sourcefn from(s: UserAttribute) -> Self
fn from(s: UserAttribute) -> Self
Converts to this type from the input type.
sourceimpl FromIterator<Packet> for PacketPile
impl FromIterator<Packet> for PacketPile
sourcefn from_iter<I: IntoIterator<Item = Packet>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Packet>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl IntoIterator for Packet
impl IntoIterator for Packet
Implement IntoIterator
so that
cert::insert_packets(sig)
just works.
sourceimpl Marshal for Packet
impl Marshal for Packet
sourceimpl MarshalInto for Packet
impl MarshalInto for Packet
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, Packet> for Packet
impl<'a> Parse<'a, Packet> for Packet
sourceimpl SerializeInto for Packet
impl SerializeInto for Packet
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 TryFrom<Packet> for Unknown
impl TryFrom<Packet> for Unknown
impl Eq for Packet
impl StructuralEq for Packet
impl StructuralPartialEq for Packet
Auto Trait Implementations
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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