[][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.

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.

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<'a> Parse<'a, Packet> for Packet[src]

fn from_file<P: AsRef<Path>>(path: P) -> Result<T>[src]

Reads from the given file. Read more

fn from_bytes<D: AsRef<[u8]> + ?Sized>(data: &'a D) -> Result<T>[src]

Reads from the given slice. Read more

impl Serialize for Packet[src]

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

Writes a serialized version of the object to o.

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

Exports a serialized version of the object to o. Read more

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 SerializeInto for Packet[src]

fn serialized_len(&self) -> usize[src]

Computes the maximal length of the serialized representation. Read more

fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>[src]

Serializes into the given buffer. Read more

fn to_vec(&self) -> Result<Vec<u8>>[src]

Serializes the packet to a vector.

fn export_into(&self, buf: &mut [u8]) -> Result<usize>[src]

Exports into the given buffer. Read more

fn export_to_vec(&self) -> Result<Vec<u8>>[src]

Exports to a vector. Read more

impl MarshalInto for Packet[src]

fn to_vec(&self) -> Result<Vec<u8>>[src]

Serializes the packet to a vector.

fn export_to_vec(&self) -> Result<Vec<u8>>[src]

Exports to a vector. Read more

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

impl From<Packet> for Tag[src]

impl From<Unknown> for Packet[src]

impl From<Signature4> for Packet[src]

impl From<OnePassSig3> for Packet[src]

impl From<Marker> for Packet[src]

impl From<Trust> for Packet[src]

impl From<UserID> for Packet[src]

impl From<UserAttribute> for Packet[src]

impl From<Literal> for Packet[src]

impl From<CompressedData> for Packet[src]

impl From<SEIP1> for Packet[src]

impl From<SKESK4> for Packet[src]

impl From<SKESK5> for Packet[src]

impl From<PKESK3> for Packet[src]

impl From<MDC> for Packet[src]

impl From<AED1> for Packet[src]

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

impl From<Signature> for Packet[src]

impl From<OnePassSig> for Packet[src]

impl From<PKESK> for Packet[src]

impl From<SKESK> 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<SEIP> for Packet[src]

impl From<AED> for Packet[src]

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

impl From<Packet> for PacketPile[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 Eq for Packet[src]

impl PartialEq<Packet> for Packet[src]

impl Clone for Packet[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Deref for Packet[src]

type Target = Common

The resulting type after dereferencing.

impl Hash for Packet[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<'a> DerefMut for Packet[src]

impl FromIterator<Packet> for PacketPile[src]

impl Debug for Packet[src]

impl TryFrom<Packet> for Cert[src]

type Error = Error

The type returned in the event of a conversion error.

impl Arbitrary for Packet[src]

fn shrink(&self) -> Box<dyn Iterator<Item = Self> + 'static>

Auto Trait Implementations

impl Send for Packet

impl Sync for Packet

Blanket Implementations

impl<T> From for 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, U> Into for T where
    U: From<T>, 
[src]

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

type Owned = T

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip for T where
    V: MultiLane<T>,