On Tue, 21 Nov 2010 at 20:51:12 +0100, Franck Joncourt wrote: > Is there a proper document which explains to us how the fields are organized > in a > keyblock according to the algorithm used? I have looked at the gnupg sources, > and found a bit of information in build_packet.c, but this is still confused.
The description of OpenPGP public-key packets, as GnuPG implements it, can be found in RFC 4880 section 5.5.2 [1]. (I find it easier to read than C code :-P) The meaning of the first 6 octets is identical for all algorithms. The public-key algorithm itself is given by the 6th byte as per RFC 4880 section 9.1. Then follows a number of multiprecision integers (MPI) depending on the algorithm: RSA (algorithm 1 to 3) public keys have 2 MPIs, DSA (algorithm 17) public keys have 4, and Elgamal (algorithm 16 and 20) public keys have 3. Now, what is commonly called "length" of the key is always the length of the first of said MPIs (public modulus in case of RSA, prime p in case of DSA and Elgamal). So Fabrizio's patch seems to fix the issue. I pushed (a slightly simplified version of) it to trunk (rev 563). > By the way, I have found that a pgpring program is also provided by the mutt > package (/usr/lib/mutt/pgpring), whose source files are a bit different :( But > at a first look, there are enhancements, and the program still displays the > wrong > key length. Filed as #741213. Cheers, -- Guilhem. [1] https://tools.ietf.org/html/rfc4880#section-5.5.2
signature.asc
Description: Digital signature