Re: packet syntax

2018-04-13 Thread FuzzyDrawrings via Gnupg-users

Edgar Pettijohn wrote:

>  thought I read somewhere that gpg creates version 4 packets.

True. But the version 4 public-key packet specification only tells you what 
information will be contained in the packet, not the format used for the packet 
header.

- fuzzy

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: packet syntax

2018-04-12 Thread edgar

On Apr 12, 2018 3:39 AM, Werner Koch  wrote:
>
> On Thu, 12 Apr 2018 05:29, ed...@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.
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: packet syntax

2018-04-12 Thread edgar

On Apr 12, 2018 2:30 AM, FuzzyDrawrings via Gnupg-users  
wrote:
>
> Edgar Pettijohn wrote:
>
> > the first word is `99' which in binary would be 
> > `10011001'. I was expecting to encounter `11000110'.
>
> You were expecting the packet header to be written in the "new" format, but 
> it is actually written in the "old" format (indicated by it beginning with 
> "10" vs "11"). See RFC-4880 section 4.2.

This is what I thought I was seeing, but thought I read somewhere that gpg 
creates version 4 packets.  Thanks.
>
> Public key packets have a Tag ID of 6, and the "new" format isn't required 
> unless the packet has a Tag ID greater than 15. 
>
> -fuzzy
>
> ___
> Gnupg-users mailing list
> Gnupg-users@gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: packet syntax

2018-04-12 Thread FuzzyDrawrings via Gnupg-users
Edgar Pettijohn wrote:

> the first word is `99' which in binary would be 
> `10011001'. I was expecting to encounter `11000110'.

You were expecting the packet header to be written in the "new" format, but it 
is actually written in the "old" format (indicated by it beginning with "10" vs 
"11"). See RFC-4880 section 4.2.

Public key packets have a Tag ID of 6, and the "new" format isn't required 
unless the packet has a Tag ID greater than 15. 

-fuzzy

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: packet syntax

2018-04-12 Thread Werner Koch
On Thu, 12 Apr 2018 05:29, ed...@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.


pgpcb8oy1oEQA.pgp
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


packet syntax

2018-04-11 Thread Edgar Pettijohn
I'm trying to learn the pgp packet syntax. I created a new key with gpg2 
--gen-key and then gpg2 --export > pubkey.key and then gpg2 --dearmor 
pubkey.key. Which left me with a pubkey.key.gpg file. I then 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 thinking that 
perhaps I have missed something simple and just need a nudge in the 
right direction.


Thanks in advance,


Edgar


___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users