[][src]Enum sequoia_openpgp::Packet

pub enum Packet {
    Unknown(Unknown),
    Signature(Signature),
    OnePassSig(OnePassSig),
    PublicKey(Key),
    PublicSubkey(Key),
    SecretKey(Key),
    SecretSubkey(Key),
    UserID(UserID),
    UserAttribute(UserAttribute),
    Literal(Literal),
    CompressedData(CompressedData),
    PKESK(PKESK),
    SKESK(SKESK),
    SEIP(SEIP),
    MDC(MDC),
    AED(AED),
}

The OpenPGP packets that Sequoia understands.

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. The Unknown packet is basically a binary blob that includes the packet's tag.

The unknown packet is also used for packets that are understood, but use unsupported options. For instance, when the packet parser encounters a compressed data packet with an unknown compression algorithm, it returns the packet in an Unknown packet rather than a CompressedData packet.

Variants

Unknown(Unknown)

Unknown packet.

Signature(Signature)

Signature packet.

OnePassSig(OnePassSig)

One pass signature packet.

PublicKey(Key)

Public key packet.

PublicSubkey(Key)

Public subkey packet.

SecretKey(Key)

Public/Secret key pair.

SecretSubkey(Key)

Public/Secret subkey pair.

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.

Methods from Deref<Target = Common>

Important traits for PacketIter<'a>
pub fn descendants(&self) -> PacketIter[src]

Returns an iterator over all of the packet's descendants, in depth-first order.

pub fn body(&self) -> Option<&[u8]>[src]

Retrieves the packet's body.

Packets can store a sequence of bytes as body, e.g. if the maximum recursion level is reached while parsing a sequence of packets, the container's body is stored as is.

pub fn set_body(&mut self, data: Vec<u8>)[src]

Sets the packet's body.

Setting the body clears the old body, or any of the packet's descendants.

Trait Implementations

impl Serialize for Packet[src]

fn serialize<W: Write>(&self, o: &mut W) -> 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 to_vec(&self) -> Result<Vec<u8>>[src]

Serializes the packet to a vector.

impl From<Unknown> for Packet[src]

impl From<Signature> for Packet[src]

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

impl From<SKESK4> for Packet[src]

impl From<SKESK5> for Packet[src]

impl From<PKESK> for Packet[src]

impl From<MDC> for Packet[src]

impl From<AED> for Packet[src]

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

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

Auto Trait Implementations

impl Send for Packet

impl !Sync for Packet

Blanket Implementations

impl<T> From for T[src]

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.