packet syntax

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


On Thu, 12 Apr 2018 05:29, edgar at pettijohn-web.com 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:

  0x10011001 
     !^^^^##-  0x01  = 2 length bytes follow.
     !!------- 0x06  = Public key
     !-------- Clear = Old style CTB
  0x11000110  
     !^^^^^^
     !!------- 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


Shalom-Salam,

   Werner

-- 
#  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: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20180412/4b0bc737/attachment-0001.sig>


More information about the Gnupg-users mailing list