#[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),
Padding(Padding),
}Expand description
Enumeration of packet types.
The different OpenPGP packets are detailed in Section 5 of RFC 9580.
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.
§A note on equality
We define equality on Packet as the equality of the serialized
form of their packet bodies as defined by RFC 9580. 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.
Padding(Padding)
Padding packet.
Implementations§
Source§impl 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 5 of RFC 9580.
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 is_critical(&self) -> bool
pub fn is_critical(&self) -> bool
Returns whether this is a critical packet.
Upon encountering an unknown critical packet, implementations MUST reject the whole packet sequence. On the other hand, unknown non-critical packets MUST be ignored. See Section 4.3 of RFC 9580.
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§
Source§impl Any<CompressedData> for Packet
impl Any<CompressedData> for Packet
Source§fn downcast(self) -> Result<CompressedData, Packet>
fn downcast(self) -> Result<CompressedData, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&CompressedData>
fn downcast_ref(&self) -> Option<&CompressedData>
Source§fn downcast_mut(&mut self) -> Option<&mut CompressedData>
fn downcast_mut(&mut self) -> Option<&mut CompressedData>
Source§impl Any<Key<PublicParts, PrimaryRole>> for Packet
impl Any<Key<PublicParts, PrimaryRole>> for Packet
Source§fn downcast(self) -> Result<Key<PublicParts, PrimaryRole>, Packet>
fn downcast(self) -> Result<Key<PublicParts, PrimaryRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<PublicParts, PrimaryRole>>
fn downcast_ref(&self) -> Option<&Key<PublicParts, PrimaryRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, PrimaryRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, PrimaryRole>>
Source§impl Any<Key<PublicParts, SubordinateRole>> for Packet
impl Any<Key<PublicParts, SubordinateRole>> for Packet
Source§fn downcast(self) -> Result<Key<PublicParts, SubordinateRole>, Packet>
fn downcast(self) -> Result<Key<PublicParts, SubordinateRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<PublicParts, SubordinateRole>>
fn downcast_ref(&self) -> Option<&Key<PublicParts, SubordinateRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, SubordinateRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, SubordinateRole>>
Source§impl Any<Key<PublicParts, UnspecifiedRole>> for Packet
impl Any<Key<PublicParts, UnspecifiedRole>> for Packet
Source§fn downcast(self) -> Result<Key<PublicParts, UnspecifiedRole>, Packet>
fn downcast(self) -> Result<Key<PublicParts, UnspecifiedRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<PublicParts, UnspecifiedRole>>
fn downcast_ref(&self) -> Option<&Key<PublicParts, UnspecifiedRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, UnspecifiedRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<PublicParts, UnspecifiedRole>>
Source§impl Any<Key<SecretParts, PrimaryRole>> for Packet
impl Any<Key<SecretParts, PrimaryRole>> for Packet
Source§fn downcast(self) -> Result<Key<SecretParts, PrimaryRole>, Packet>
fn downcast(self) -> Result<Key<SecretParts, PrimaryRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<SecretParts, PrimaryRole>>
fn downcast_ref(&self) -> Option<&Key<SecretParts, PrimaryRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, PrimaryRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, PrimaryRole>>
Source§impl Any<Key<SecretParts, SubordinateRole>> for Packet
impl Any<Key<SecretParts, SubordinateRole>> for Packet
Source§fn downcast(self) -> Result<Key<SecretParts, SubordinateRole>, Packet>
fn downcast(self) -> Result<Key<SecretParts, SubordinateRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<SecretParts, SubordinateRole>>
fn downcast_ref(&self) -> Option<&Key<SecretParts, SubordinateRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, SubordinateRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, SubordinateRole>>
Source§impl Any<Key<SecretParts, UnspecifiedRole>> for Packet
impl Any<Key<SecretParts, UnspecifiedRole>> for Packet
Source§fn downcast(self) -> Result<Key<SecretParts, UnspecifiedRole>, Packet>
fn downcast(self) -> Result<Key<SecretParts, UnspecifiedRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<SecretParts, UnspecifiedRole>>
fn downcast_ref(&self) -> Option<&Key<SecretParts, UnspecifiedRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, UnspecifiedRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<SecretParts, UnspecifiedRole>>
Source§impl Any<Key<UnspecifiedParts, PrimaryRole>> for Packet
impl Any<Key<UnspecifiedParts, PrimaryRole>> for Packet
Source§fn downcast(self) -> Result<Key<UnspecifiedParts, PrimaryRole>, Packet>
fn downcast(self) -> Result<Key<UnspecifiedParts, PrimaryRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<UnspecifiedParts, PrimaryRole>>
fn downcast_ref(&self) -> Option<&Key<UnspecifiedParts, PrimaryRole>>
Source§fn downcast_mut(&mut self) -> Option<&mut Key<UnspecifiedParts, PrimaryRole>>
fn downcast_mut(&mut self) -> Option<&mut Key<UnspecifiedParts, PrimaryRole>>
Source§impl Any<Key<UnspecifiedParts, SubordinateRole>> for Packet
impl Any<Key<UnspecifiedParts, SubordinateRole>> for Packet
Source§fn downcast(self) -> Result<Key<UnspecifiedParts, SubordinateRole>, Packet>
fn downcast(self) -> Result<Key<UnspecifiedParts, SubordinateRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<UnspecifiedParts, SubordinateRole>>
fn downcast_ref(&self) -> Option<&Key<UnspecifiedParts, SubordinateRole>>
Source§fn downcast_mut(
&mut self,
) -> Option<&mut Key<UnspecifiedParts, SubordinateRole>>
fn downcast_mut( &mut self, ) -> Option<&mut Key<UnspecifiedParts, SubordinateRole>>
Source§impl Any<Key<UnspecifiedParts, UnspecifiedRole>> for Packet
impl Any<Key<UnspecifiedParts, UnspecifiedRole>> for Packet
Source§fn downcast(self) -> Result<Key<UnspecifiedParts, UnspecifiedRole>, Packet>
fn downcast(self) -> Result<Key<UnspecifiedParts, UnspecifiedRole>, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&Key<UnspecifiedParts, UnspecifiedRole>>
fn downcast_ref(&self) -> Option<&Key<UnspecifiedParts, UnspecifiedRole>>
Source§fn downcast_mut(
&mut self,
) -> Option<&mut Key<UnspecifiedParts, UnspecifiedRole>>
fn downcast_mut( &mut self, ) -> Option<&mut Key<UnspecifiedParts, UnspecifiedRole>>
Source§impl Any<Literal> for Packet
impl Any<Literal> for Packet
Source§impl Any<MDC> for Packet
impl Any<MDC> for Packet
Source§impl Any<Marker> for Packet
impl Any<Marker> for Packet
Source§impl Any<OnePassSig> for Packet
impl Any<OnePassSig> for Packet
Source§fn downcast(self) -> Result<OnePassSig, Packet>
fn downcast(self) -> Result<OnePassSig, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&OnePassSig>
fn downcast_ref(&self) -> Option<&OnePassSig>
Source§fn downcast_mut(&mut self) -> Option<&mut OnePassSig>
fn downcast_mut(&mut self) -> Option<&mut OnePassSig>
Source§impl Any<PKESK> for Packet
impl Any<PKESK> for Packet
Source§impl Any<Padding> for Packet
impl Any<Padding> for Packet
Source§impl Any<SEIP> for Packet
impl Any<SEIP> for Packet
Source§impl Any<SKESK> for Packet
impl Any<SKESK> for Packet
Source§impl Any<Signature> for Packet
impl Any<Signature> for Packet
Source§impl Any<Trust> for Packet
impl Any<Trust> for Packet
Source§impl Any<Unknown> for Packet
impl Any<Unknown> for Packet
Source§impl Any<UserAttribute> for Packet
impl Any<UserAttribute> for Packet
Source§fn downcast(self) -> Result<UserAttribute, Packet>
fn downcast(self) -> Result<UserAttribute, Packet>
T, returning the packet if it fails. Read moreSource§fn downcast_ref(&self) -> Option<&UserAttribute>
fn downcast_ref(&self) -> Option<&UserAttribute>
Source§fn downcast_mut(&mut self) -> Option<&mut UserAttribute>
fn downcast_mut(&mut self) -> Option<&mut UserAttribute>
Source§impl Any<UserID> for Packet
impl Any<UserID> for Packet
impl Eq for Packet
Source§impl From<CompressedData> for Packet
impl From<CompressedData> for Packet
Source§fn from(s: CompressedData) -> Packet
fn from(s: CompressedData) -> Packet
Source§impl From<Key<PublicParts, PrimaryRole>> for Packet
impl From<Key<PublicParts, PrimaryRole>> for Packet
Source§fn from(k: Key<PublicParts, PrimaryRole>) -> Packet
fn from(k: Key<PublicParts, PrimaryRole>) -> Packet
Convert the Key struct to a Packet.
Source§impl From<Key<PublicParts, SubordinateRole>> for Packet
impl From<Key<PublicParts, SubordinateRole>> for Packet
Source§fn from(k: Key<PublicParts, SubordinateRole>) -> Packet
fn from(k: Key<PublicParts, SubordinateRole>) -> Packet
Convert the Key struct to a Packet.
Source§impl From<Key<SecretParts, PrimaryRole>> for Packet
impl From<Key<SecretParts, PrimaryRole>> for Packet
Source§fn from(k: Key<SecretParts, PrimaryRole>) -> Packet
fn from(k: Key<SecretParts, PrimaryRole>) -> Packet
Convert the Key struct to a Packet.
Source§impl From<Key<SecretParts, SubordinateRole>> for Packet
impl From<Key<SecretParts, SubordinateRole>> for Packet
Source§fn from(k: Key<SecretParts, SubordinateRole>) -> Packet
fn from(k: Key<SecretParts, SubordinateRole>) -> Packet
Convert the Key struct to a Packet.
Source§impl From<OnePassSig3> for Packet
impl From<OnePassSig3> for Packet
Source§fn from(p: OnePassSig3) -> Packet
fn from(p: OnePassSig3) -> Packet
Source§impl From<OnePassSig6> for Packet
impl From<OnePassSig6> for Packet
Source§fn from(p: OnePassSig6) -> Packet
fn from(p: OnePassSig6) -> Packet
Source§impl From<OnePassSig> for Packet
impl From<OnePassSig> for Packet
Source§fn from(s: OnePassSig) -> Packet
fn from(s: OnePassSig) -> Packet
Source§impl From<Packet> for PacketPile
impl From<Packet> for PacketPile
Source§fn from(p: Packet) -> PacketPile
fn from(p: Packet) -> PacketPile
Source§impl From<Signature3> for Packet
impl From<Signature3> for Packet
Source§fn from(s: Signature3) -> Packet
fn from(s: Signature3) -> Packet
Source§impl From<Signature4> for Packet
impl From<Signature4> for Packet
Source§fn from(s: Signature4) -> Packet
fn from(s: Signature4) -> Packet
Source§impl From<Signature6> for Packet
impl From<Signature6> for Packet
Source§fn from(s: Signature6) -> Packet
fn from(s: Signature6) -> Packet
Source§impl From<UserAttribute> for Packet
impl From<UserAttribute> for Packet
Source§fn from(s: UserAttribute) -> Packet
fn from(s: UserAttribute) -> Packet
Source§impl FromIterator<Packet> for PacketPile
impl FromIterator<Packet> for PacketPile
Source§fn from_iter<I>(iter: I) -> PacketPilewhere
I: IntoIterator<Item = Packet>,
fn from_iter<I>(iter: I) -> PacketPilewhere
I: IntoIterator<Item = Packet>,
Source§impl IntoIterator for Packet
Implement IntoIterator so that
cert::insert_packets(sig) just works.
impl IntoIterator for Packet
Implement IntoIterator so that
cert::insert_packets(sig) just works.
Source§impl Marshal for Packet
impl Marshal for Packet
Source§impl MarshalInto for Packet
impl MarshalInto for Packet
Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Error>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Error>
Source§impl<'a> Parse<'a, Packet> for Packet
impl<'a> Parse<'a, Packet> for Packet
Source§fn from_buffered_reader<R>(reader: R) -> Result<Packet, Error>where
R: BufferedReader<Cookie> + 'a,
fn from_buffered_reader<R>(reader: R) -> Result<Packet, Error>where
R: BufferedReader<Cookie> + 'a,
Source§impl SerializeInto for Packet
impl SerializeInto for Packet
Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Error>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, Error>
impl StructuralPartialEq for Packet
Source§impl TryFrom<Packet> for Unknown
impl TryFrom<Packet> for Unknown
Auto Trait Implementations§
impl !Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnsafeUnpin for Packet
impl UnwindSafe for Packet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more