Enum sequoia_openpgp::Packet[][src]

#[non_exhaustive]
pub enum Packet {
Show 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),
}

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)

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.

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.

Implementations

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]

fn clone(&self) -> Packet[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for Packet[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a> Deref for Packet[src]

type Target = Common

The resulting type after dereferencing.

fn deref(&self) -> &Self::Target[src]

Dereferences the value.

impl<'a> DerefMut for Packet[src]

fn deref_mut(&mut self) -> &mut Common[src]

Mutably dereferences the value.

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

fn from(p: &Packet) -> Tag[src]

Performs the conversion.

impl From<AED> for Packet[src]

fn from(p: AED) -> Self[src]

Performs the conversion.

impl From<AED1> for Packet[src]

fn from(p: AED1) -> Self[src]

Performs the conversion.

impl From<CompressedData> for Packet[src]

fn from(s: CompressedData) -> Self[src]

Performs the conversion.

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]

fn from(s: Literal) -> Self[src]

Performs the conversion.

impl From<MDC> for Packet[src]

fn from(s: MDC) -> Self[src]

Performs the conversion.

impl From<Marker> for Packet[src]

fn from(p: Marker) -> Self[src]

Performs the conversion.

impl From<OnePassSig> for Packet[src]

fn from(s: OnePassSig) -> Self[src]

Performs the conversion.

impl From<OnePassSig3> for Packet[src]

fn from(p: OnePassSig3) -> Self[src]

Performs the conversion.

impl From<PKESK> for Packet[src]

fn from(p: PKESK) -> Self[src]

Performs the conversion.

impl From<PKESK3> for Packet[src]

fn from(p: PKESK3) -> Self[src]

Performs the conversion.

impl From<Packet> for Tag[src]

fn from(p: Packet) -> Tag[src]

Performs the conversion.

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

fn from(p: Packet) -> Self[src]

Performs the conversion.

impl From<Packet> for PacketPile[src]

fn from(p: Packet) -> Self[src]

Performs the conversion.

impl From<SEIP> for Packet[src]

fn from(p: SEIP) -> Self[src]

Performs the conversion.

impl From<SEIP1> for Packet[src]

fn from(s: SEIP1) -> Self[src]

Performs the conversion.

impl From<SKESK> for Packet[src]

fn from(p: SKESK) -> Self[src]

Performs the conversion.

impl From<SKESK4> for Packet[src]

fn from(s: SKESK4) -> Self[src]

Performs the conversion.

impl From<SKESK5> for Packet[src]

fn from(s: SKESK5) -> Self[src]

Performs the conversion.

impl From<Signature> for Packet[src]

fn from(s: Signature) -> Self[src]

Performs the conversion.

impl From<Signature4> for Packet[src]

fn from(s: Signature4) -> Self[src]

Performs the conversion.

impl From<Trust> for Packet[src]

fn from(s: Trust) -> Self[src]

Performs the conversion.

impl From<Unknown> for Packet[src]

fn from(s: Unknown) -> Self[src]

Performs the conversion.

impl From<UserAttribute> for Packet[src]

fn from(s: UserAttribute) -> Self[src]

Performs the conversion.

impl From<UserID> for Packet[src]

fn from(s: UserID) -> Self[src]

Performs the conversion.

impl FromIterator<Packet> for PacketPile[src]

fn from_iter<I: IntoIterator<Item = Packet>>(iter: I) -> Self[src]

Creates a value from an iterator. Read more

impl Hash for Packet[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

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

Implement IntoIterator so that cert::insert_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?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. 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 MarshalInto 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 export_into(&self, buf: &mut [u8]) -> Result<usize>[src]

Exports into the given buffer. Read more

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

fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<Self>[src]

Reads from the given reader.

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 + Send + Sync>(data: &'a D) -> Result<T>[src]

Reads from the given slice. Read more

impl PartialEq<Packet> for Packet[src]

fn eq(&self, other: &Packet) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Packet) -> bool[src]

This method tests for !=.

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

type Error = Error

The type returned in the event of a conversion error.

fn try_from(p: Packet) -> Result<Self>[src]

Performs the conversion.

impl Eq for Packet[src]

impl StructuralEq for Packet[src]

impl StructuralPartialEq for Packet[src]

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn __clone_box(&self, Private) -> *mut ()[src]

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.