Skip to content
kazu-yamamotoPublic

About

A PGP packet visualizer

Resources

Stars

188 stars

Watchers

9 watching

Forks

Repository files navigation

GitHub Actions status

pgpdump: a PGP packet visualizer

Overview

pgpdump is a PGP packet visualizer which displays the packet format of OpenPGP (RFC 9580 and RFC 4880), including the post-quantum algorithms of RFC 9980, and PGP version 2 (RFC 1991). It also displays the LibrePGP extensions generated by GnuPG (draft-koch-librepgp): version 5 keys and signatures, the OCB Encrypted Data packet (tag 20), and version 5 Symmetric-Key Encrypted Session Key packets.

Here is an example:

% pgpdump test/sig1
Old: Marker Packet(tag 10)(3 bytes)
	String - ...
New: One-Pass Signature Packet(tag 4)(13 bytes)
	New version(3)
	Sig type - Signature of a binary document(0x00).
	Hash alg - SHA1(hash 2)
	Pub alg - DSA Digital Signature Algorithm(pub 17)
	Key ID - 0xA79778E247B63037
	Next packet - other than one pass signature
New: Signature Packet(tag 2)(63 bytes)
	Ver 3 - old
	Hash material(5 bytes):
		Sig type - Signature of a binary document(0x00).
		Creation time - Fri Nov 27 22:35:02 JST 1998
	Key ID - 0xA79778E247B63037
	Pub alg - DSA Digital Signature Algorithm(pub 17)
	Hash alg - SHA1(hash 2)
	Hash left 2 bytes - 8f 82
	DSA r(160 bits) - ...
	DSA s(157 bits) - ...
		-> hash(DSA q bits)

Reading the output

Each packet starts with a line like this:

New: Signature Packet(tag 2)(63 bytes)
  • Old: or New: is the format of the packet header. Old: is the legacy format, which is also used by PGP 2.x, and New: is the OpenPGP format (see Section 4.2 of RFC 9580). This is independent of the version of the packet itself. A version 4 key may be stored in an old-format packet, for example.
  • (tag 2) is the packet type ID.
  • (63 bytes) is the length of the packet body. (until eof) means that the length is indeterminate. partial start, partial continue, and partial end show the chunks of a packet with partial body lengths.

The indented lines are the fields of the packet body. The version of the packet is shown in one of these forms:

Output Meaning
Ver 3 - old version 2 or 3 key or signature (PGP 2.x, RFC 1991)
Ver 4 - new version 4 key or signature (RFC 4880)
Ver 5 - librepgp version 5 key or signature (LibrePGP)
Ver 6 - latest version 6 key or signature (RFC 9580)
Old version(2), New version(3), Latest version(6) version of a session key or one-pass signature packet
LibrePGP version(5) version of a Symmetric-Key Encrypted Session Key packet (LibrePGP)
Ver 1, Ver 2 version of a Symmetrically Encrypted and Integrity Protected Data packet or an OCB Encrypted Data packet

Other conventions:

  • A number in parentheses such as (pub 17), (sym 9), (hash 8), (aead 2), (comp 1), (s2k 3), or (sub 2) is the algorithm ID or subpacket type ID defined in the RFCs and LibrePGP.
  • Hashed Sub: is a subpacket in the hashed area of a signature and Sub: is one in the unhashed area. (critical) means that the critical bit is set.
  • (N bits) is the size of a multi-precision integer, and (N bytes) is the size of fixed-length key material or other data.
  • ... means that the data is omitted. Use -i (integers and key material), -l (literal data), -m (marker packets), or -p (private packets) to show it.
  • A line starting with -> is a hint about the contents of the preceding encrypted or signed data.

Installation

Take the following steps to install pgpdump from a release tarball:

% ./configure
% make
% su
# make install

To build from Git, run autoreconf -fviW all before running the above commands.

Binaries are available for Mac OS X via Homebrew:

% brew install pgpdump

Usage

To know how to use pgpdump, type pgpdump -h.

Some examples are stored in the test directory. Also, you can visualize your pubring and secring.

Home page

The official home page of pgpdump is:

Bugs

  • pgpdump assumes that a compressed packet continues until the end of the specified file.
  • pgpdump does not decrypt encrypted packets.

Testing

To run all of the tests:

% make check

or:

% make
% ./test/test

To run specific tests:

% make check TESTS="test/pub.res test/sig.res"

or:

% make
% ./test/test test/pub.res test/sig.res

About

A PGP packet visualizer

Resources

Stars

188 stars

Watchers

9 watching

Forks

Releases

Packages

Used by

Contributors

Languages