1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! A library for parsing and inspecting OpenPGP (GPG) packets.
//!
//! This crate provides tools for decoding ASCII-armored PGP data and parsing
//! the binary packet structure according to RFC 4880 and RFC 9580.
//!
//! # Quick Start
//!
//! ```
//! use gpg_inspector_lib::{parse, Packet, PacketBody};
//!
//! let armored_key = r#"-----BEGIN PGP PUBLIC KEY BLOCK-----
//!
//! mDMEZ... (your armored data)
//! -----END PGP PUBLIC KEY BLOCK-----"#;
//!
//! // Parse returns an error for invalid/incomplete data
//! // For real usage, provide valid armored PGP data
//! ```
//!
//! # Modules
//!
//! - [`armor`] - ASCII armor decoding (Base64 + CRC24 checksum)
//! - [`error`] - Error types for parsing failures
//! - [`lookup`] - Algorithm and format lookup tables
//! - [`packet`] - Packet parsing and type definitions
//! - [`stream`] - Binary stream reader abstraction
use Arc;
pub use ;
pub use ;
pub use ;
pub use ByteStream;
/// 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
///
/// ```ignore
/// let packets = gpg_inspector_lib::parse(armored_data)?;
/// for packet in packets {
/// println!("Packet: {} ({} bytes)", packet.tag, packet.end - packet.start);
/// }
/// ```
/// Parses raw binary PGP data into a vector of packets.
///
/// Use this when you have already decoded the armor or are working
/// with raw binary PGP data.
///
/// # Arguments
///
/// * `bytes` - Raw binary PGP packet data
///
/// # Errors
///
/// Returns an error if the packet structure is malformed.