Struct sequoia_openpgp::packet::header::Header
source · pub struct Header { /* private fields */ }
Expand description
A packet’s header.
See Section 4.2 of RFC 4880 for details.
Implementations§
source§impl Header
impl Header
sourcepub fn new(ctb: CTB, length: BodyLength) -> Self
pub fn new(ctb: CTB, length: BodyLength) -> Self
Creates a new header.
sourcepub fn length(&self) -> &BodyLength
pub fn length(&self) -> &BodyLength
Returns the header’s length.
sourcepub fn valid(&self, future_compatible: bool) -> Result<()>
pub fn valid(&self, future_compatible: bool) -> Result<()>
Checks the header for validity.
A header is consider invalid if:
- The tag is
Tag::Reserved
. - The tag is
Tag::Unknown
orTag::Private
andfuture_compatible
is false. - The length encoding is invalid for the packet (e.g.,
partial body encoding may not be used for
PKESK
packets) - The lengths are unreasonable for a packet (e.g., a
PKESK
orSKESK
larger than 10 KB).
Trait Implementations§
source§impl MarshalInto for Header
impl MarshalInto for Header
source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Computes the maximal length of the serialized representation. Read more
source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serializes into the given buffer. Read more