Paul Tagliamonte paultag@gmail.com writes:
pgp_put_public_rsa_key seems to throw an assertion error:
Note that the pgp functions in Nettle are undocumented and unfinished. Cool that anybody else is having a look at them.
Can someone who groks the code confirm this?
Can't say I really grok the code either, I wrote those functions back in 2007... But it looks fishy to me with two calls to pgp_put_header, using the same tag value PGP_TAG_PUBLIC_KEY. If you have read the spec recently, is there any way that could be correct?
I'd suggest deleting the second call to pgp_put_header (the one with the PGP_LENGTH_TWO_OCTETS argument). The the correct body length should be passed to the first pgp_put_header call, and the variable start, and the assert, check that we really generate a packet body matching that length.
In case you'd like to try to get some more of the pgp code in shape, additional testcases would be a good place to start.
The way I remember it, I tried passing the generated pckets to gpg, but it was a bit difficult to get any interoperability by supporting only the "new" openpgp formats. Things might have changed since then, of course.
Regards, /Niels