packet syntax

edgar at pettijohn-web.com edgar at pettijohn-web.com
Thu Apr 12 14:01:18 CEST 2018


On Apr 12, 2018 3:39 AM, Werner Koch <wk at gnupg.org> wrote:
>
> 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
>

Cool. I'll check that out.

Thanks
>
> Shalom-Salam,
>
>    Werner
>
> -- 
> #  Please read:  Daniel Ellsberg - The Doomsday Machine  #
> Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


More information about the Gnupg-users mailing list