[1.4.0] hidden recipient vs. ID 00000000

David Shaw dshaw at jabberwocky.com
Thu Jan 27 21:07:33 CET 2005


On Thu, Jan 27, 2005 at 04:23:51PM +0100, Janos.Farkas-lists+priv-#RVXrkLgxX70*-gpg-dev at lists.xeon.eu.org wrote:
> Hi!
> 
> Apparently not too many use the -R option (for hidden recipient):
> 
> > gpg --version
> gpg (GnuPG) 1.4.0
> ...
> 
> > echo|gpg -eR `whoami`|gpg
> gpg: anonymous recipient; trying secret key XXXXXXXX ...
> gpg: okay, we are the anonymous recipient.
> gpg: encrypted with 1312-bit RSA key, ID 00000000, created 1998-02-09
>       "Werner Koch <wk at isil.d.shuttle.de>"
> 
> I guess that no ID is signified by the id zero in some place, which is
> seemingly "allocated" by a friend of us ;)
> 
> Nevertheless, I was surprised when opening such a file almost claimed it
> was destined to Werner...

That's pretty amusing.  The problem is that hidden recipients are
indicated, as you noted, by a keyid of all zeroes.  However, the old
v3 Elgamal signing keys, being unsupported, also end up with a keyid
of all zeroes.  Werner's old key is a v3 Elgamal, and so it looks like
all hidden recipient messages are handled by him.

Try the attached patch.  It changes the "no keyid" case to all FFs
instead of zeroes.  All FFs is as good as all zeroes here, especially
since all zeroes is reserved.

David
-------------- next part --------------
Index: keyid.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/keyid.c,v
retrieving revision 1.52
diff -u -r1.52 keyid.c
--- keyid.c	30 Dec 2004 03:26:57 -0000	1.52
+++ keyid.c	27 Jan 2005 20:00:02 -0000
@@ -280,7 +280,7 @@
 	  sk->keyid[1]=keyid[1];
 	}
       else
-	sk->keyid[0]=sk->keyid[1]=keyid[0]=keyid[1]=lowbits=0;
+	sk->keyid[0]=sk->keyid[1]=keyid[0]=keyid[1]=lowbits=0xFFFFFFFF;
     }
   else
     {
@@ -298,7 +298,7 @@
 	  sk->keyid[1] = keyid[1];
 	}
       else
-	sk->keyid[0]=sk->keyid[1]=keyid[0]=keyid[1]=lowbits=0;
+	sk->keyid[0]=sk->keyid[1]=keyid[0]=keyid[1]=lowbits=0xFFFFFFFF;
     }
 
   return lowbits;
@@ -334,7 +334,7 @@
 	  pk->keyid[1] = keyid[1];
 	}
       else
-	pk->keyid[0]=pk->keyid[1]=keyid[0]=keyid[1]=lowbits=0;
+	pk->keyid[0]=pk->keyid[1]=keyid[0]=keyid[1]=lowbits=0xFFFFFFFF;
     }
   else
     {
@@ -352,7 +352,7 @@
 	  pk->keyid[1] = keyid[1];
 	}
       else
-	pk->keyid[0]=pk->keyid[1]=keyid[0]=keyid[1]=lowbits=0;
+	pk->keyid[0]=pk->keyid[1]=keyid[0]=keyid[1]=lowbits=0xFFFFFFFF;
     }
 
   return lowbits;


More information about the Gnupg-devel mailing list