Module sequoia_openpgp::packet::signature::subpacket

source ·
Expand description

Signature subpackets.

OpenPGP signature packets include a set of key-value attributes called subpackets. These subpackets are used to indicate when a signature was created, who created the signature, user & implementation preferences, etc. The full details are in Section 5.2.3.1 of RFC 4880.

The standard assigns each subpacket a numeric id, and describes the format of its value. One subpacket is called Notation Data and is intended as a generic key-value store. The combined size of the subpackets (including notation data) is limited to 64 KB.

Subpackets and notations can be marked as critical. If an OpenPGP implementation processes a packet that includes critical subpackets or notations that it does not understand, it is required to abort processing. This allows for forwards compatible changes by indicating whether it is safe to ignore an unknown subpacket or notation.

A number of methods are defined on Signature for working with subpackets.

§Examples

Print any Issuer Fingerprint subpackets:

let mut ppr = PacketParser::from_bytes(message_data)?;
while let PacketParserResult::Some(mut pp) = ppr {
    if let Packet::Signature(ref sig) = pp.packet {
        for fp in sig.issuer_fingerprints() {
            eprintln!("Signature allegedly issued by: {}", fp.to_string());
        }
    }

    // Get the next packet.
    ppr  = pp.recurse()?.1;
}

Structs§

Enums§