Enum sequoia_openpgp::Packet
source · 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§
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§
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 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 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 From<CompressedData> for Packet
impl From<CompressedData> for Packet
source§fn from(s: CompressedData) -> Self
fn from(s: CompressedData) -> Self
source§impl From<Key<PublicParts, PrimaryRole>> for Packet
impl From<Key<PublicParts, PrimaryRole>> for Packet
source§fn from(k: Key<PublicParts, PrimaryRole>) -> Self
fn from(k: Key<PublicParts, PrimaryRole>) -> Self
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>) -> Self
fn from(k: Key<PublicParts, SubordinateRole>) -> Self
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>) -> Self
fn from(k: Key<SecretParts, PrimaryRole>) -> Self
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>) -> Self
fn from(k: Key<SecretParts, SubordinateRole>) -> Self
Convert the Key struct to a Packet.
source§impl From<OnePassSig> for Packet
impl From<OnePassSig> for Packet
source§fn from(s: OnePassSig) -> Self
fn from(s: OnePassSig) -> Self
source§impl From<OnePassSig3> for Packet
impl From<OnePassSig3> for Packet
source§fn from(p: OnePassSig3) -> Self
fn from(p: OnePassSig3) -> Self
source§impl From<Packet> for PacketPile
impl From<Packet> for PacketPile
source§impl From<Signature4> for Packet
impl From<Signature4> for Packet
source§fn from(s: Signature4) -> Self
fn from(s: Signature4) -> Self
source§impl From<UserAttribute> for Packet
impl From<UserAttribute> for Packet
source§fn from(s: UserAttribute) -> Self
fn from(s: UserAttribute) -> Self
source§impl FromIterator<Packet> for PacketPile
impl FromIterator<Packet> for PacketPile
source§impl IntoIterator for Packet
impl IntoIterator for Packet
Implement IntoIterator so that
cert::insert_packets(sig) just works.