[][src]Enum sequoia_openpgp::Packet

pub enum Packet {
    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),
    // some variants omitted
}

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.

Public key packet.

Public subkey packet.

Public/Secret key pair.

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.

Methods

impl Packet[src]

pub fn tag(&self) -> Tag[src]

Returns the Packet's corresponding OpenPGP tag.

Tags are explained in Section 4.3 of RFC 4880.

pub fn kind(&self) -> Option<Tag>[src]

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.

Trait Implementations

impl Clone for Packet[src]

impl Debug for Packet[src]

impl<'a> Deref for Packet[src]

type Target = Common

The resulting type after dereferencing.

impl<'a> DerefMut for Packet[src]

impl Eq for Packet[src]

impl<'_> From<&'_ Packet> for Tag[src]

impl From<AED> for Packet[src]

impl From<AED1> for Packet[src]

impl From<CompressedData> for Packet[src]

impl From<Key<PublicParts, PrimaryRole>> for Packet[src]

fn from(k: Key<PublicParts, PrimaryRole>) -> Self[src]

Convert the Key struct to a Packet.

impl From<Key<PublicParts, SubordinateRole>> for Packet[src]

fn from(k: Key<PublicParts, SubordinateRole>) -> Self[src]

Convert the Key struct to a Packet.

impl From<Key<SecretParts, PrimaryRole>> for Packet[src]

fn from(k: Key<SecretParts, PrimaryRole>) -> Self[src]

Convert the Key struct to a Packet.

impl From<Key<SecretParts, SubordinateRole>> for Packet[src]

fn from(k: Key<SecretParts, SubordinateRole>) -> Self[src]

Convert the Key struct to a Packet.

impl From<Literal> for Packet[src]

impl From<MDC> for Packet[src]

impl From<Marker> for Packet[src]

impl From<OnePassSig> for Packet[src]

impl From<OnePassSig3> for Packet[src]

impl From<PKESK> for Packet[src]

impl From<PKESK3> for Packet[src]

impl From<Packet> for Tag[src]

impl From<Packet> for Result<Packet>[src]

impl From<Packet> for Option<Token>[src]

impl From<Packet> for PacketPile[src]

impl From<SEIP> for Packet[src]

impl From<SEIP1> for Packet[src]

impl From<SKESK> for Packet[src]

impl From<SKESK4> for Packet[src]

impl From<SKESK5> for Packet[src]

impl From<Signature> for Packet[src]

impl From<Signature4> for Packet[src]

impl From<Trust> for Packet[src]

impl From<Unknown> for Packet[src]

impl From<UserAttribute> for Packet[src]

impl From<UserID> for Packet[src]

impl FromIterator<Packet> for PacketPile[src]

impl Hash for Packet[src]

impl IntoIterator for Packet[src]

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

type Item = Packet

The type of the elements being iterated over.

type IntoIter = Once<Packet>

Which kind of iterator are we turning this into?

impl Marshal for Packet[src]

fn serialize(&self, o: &mut dyn Write) -> Result<()>[src]

Writes a serialized version of the specified Packet to o.

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

fn export(&self, o: &mut dyn Write) -> Result<()>[src]

Exports a serialized version of the specified Packet to o.

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

impl MarshalInto for Packet[src]

impl<'a> Parse<'a, Packet> for Packet[src]

impl PartialEq<Packet> for Packet[src]

impl Serialize for Packet[src]

impl SerializeInto for Packet[src]

impl StructuralEq for Packet[src]

impl StructuralPartialEq for Packet[src]

impl TryFrom<Packet> for Cert[src]

type Error = Error

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.