packet syntax

Werner Koch wk at
Thu Apr 12 10:39:17 CEST 2018

On Thu, 12 Apr 2018 05:29, edgar at said:

> did a hexdump of the file and the first word is `99' which in binary
> would be `10011001'. I was expecting to encounter `11000110'.  I'm

OpenPGP (RFC-4880) has several ways to encode a packet header.  This
first byte is called the CTB and reads:

     !^^^^##-  0x01  = 2 length bytes follow.
     !!------- 0x06  = Public key
     !-------- Clear = Old style CTB
     !!------- 0x06 = Public Key
     !-------- Set  = New style CTB

For a new style CTB the length bytes are Hufmann like encoded.  Bit 7 is
always set.  A basic parser can be found in gpgme/src/data-identify.c



#  Please read:  Daniel Ellsberg - The Doomsday Machine  #
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <>

More information about the Gnupg-users mailing list