Series of minor questions about OpenPGP 1

Peter Thomas p4.thomas at googlemail.com
Tue Jan 27 13:15:46 CET 2009


On Mon, Jan 26, 2009 at 5:40 PM, David Shaw <dshaw at jabberwocky.com> wrote:
> No, but you could patch it if you liked.  Take a look at the
> write_header() and write_new_header() functions in build-packet.c
Although you've convinced me that using old packet types where
possible is preferable, I still tried to get this working (just for a
better understanding of gpg's sources).
I didn't found what I've needed in those two functions, though.

I used the following patch:
--- gnupg-1.4.9/g10/build-packet.c	2007-10-23 09:50:33.000000000 +0200
+++ foo/g10/build-packet.c	2009-01-27 13:00:57.569232835 +0100
@@ -86,10 +86,7 @@
       default: break;
       }

-    if( new_ctb || pkttype > 15 ) /* new format */
 	ctb = 0xc0 | (pkttype & 0x3f);
-    else
-	ctb = 0x80 | ((pkttype & 15)<<2);
     switch( pkttype )
       {
       case PKT_ATTRIBUTE:
@@ -1261,9 +1258,6 @@
 static int
 write_new_header( IOBUF out, int ctb, u32 len, int hdrlen )
 {
-    if( hdrlen )
-	log_bug("can't cope with hdrlen yet\n");
-
     if( iobuf_put(out, ctb ) )
 	return -1;
     if( !len ) {


Does this seem ok? Or what did you meant, that I should change? Not
sure why I had to remove that log_bug call.
But when I create a new key,.. pgpdump lists new packet headers.
When I do e.g. passwd (in --edit-key) the secret key is rewritten with
new paket types, and if I do e.g. adduid, the public key is rewritten.

The trustpackets however continue to use the old style headers. *weird* ;-)


I've seen that you have some switches like force-v4-certs in gpg.
Would you be interested in a patch that adds
--force-new-paket-headers?

Best wishes,
Peter



More information about the Gnupg-users mailing list