Skip to main content

parse

Function parse 

Source
pub fn parse(input: &str) -> Result<Vec<Packet>>
Expand description

Parses ASCII-armored PGP data into a vector of packets.

This is the main entry point for parsing armored PGP data such as public keys, secret keys, signatures, and encrypted messages.

§Arguments

  • input - ASCII-armored PGP data (e.g., -----BEGIN PGP PUBLIC KEY BLOCK-----)

§Errors

Returns an error if:

  • The armor format is invalid (missing headers, bad base64, checksum mismatch)
  • The packet structure is malformed

§Example

let packets = gpg_inspector_lib::parse(armored_data)?;
for packet in packets {
    println!("Packet: {} ({} bytes)", packet.tag, packet.end - packet.start);
}