#[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
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.
§

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§

Returns the Packet's corresponding OpenPGP tag.

Tags are explained in Section 4.3 of RFC 4880.

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.

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.

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§

Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Attempts to downcast to T, returning the packet if it fails. Read more
Attempts to downcast to &T, returning None if it fails. Read more
Attempts to downcast to &mut T, returning None if it fails. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Convert the Key struct to a Packet.

Convert the Key struct to a Packet.

Convert the Key struct to a Packet.

Convert the Key struct to a Packet.

Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Creates a value from an iterator. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more

Implement IntoIterator so that cert::insert_packets(sig) just works.

The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Writes a serialized version of the specified Packet to o.

This function works recursively: if the packet contains any packets, they are also serialized.

Exports a serialized version of the specified Packet to o.

This function works recursively: if the packet contains any packets, they are also serialized.

Computes the maximal length of the serialized representation. Read more
Serializes into the given buffer. Read more
Exports into the given buffer. Read more
Serializes the packet to a vector.
Exports to a vector. Read more
Reads from the given reader.
Reads from the given file. Read more
Reads from the given slice. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Writes a serialized version of the object to o.
Exports a serialized version of the object to o. Read more
Computes the maximal length of the serialized representation. Read more
Serializes into the given buffer. Read more
Serializes the packet to a vector.
Exports into the given buffer. Read more
Exports to a vector. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Tries to convert a packet to an Unknown. Returns an error if the given packet is a container packet (i.e. a compressed data packet or an encrypted data packet of any kind).

The type returned in the event of a conversion error.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.