[git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-11-g372fb4f

by Werner Koch cvs at cvs.gnupg.org
Fri Jan 6 14:31:59 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  372fb4fc0661014ccd9275c89e6da2208f87155f (commit)
      from  5988c8bfb7eafaca53c8abeb793f189acd3177c6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 372fb4fc0661014ccd9275c89e6da2208f87155f
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Jan 6 13:33:10 2012 +0100

    gpg: Allow use of a standard space separated fingerprint.
    
    * common/userids.c (classify_user_id): Check for space separated GPG
    fingerprint.

diff --git a/NEWS b/NEWS
index 65297dd..7d1ae47 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 Noteworthy changes in version 2.1.0beta4 (unreleased)
 -----------------------------------------------------
 
+ * GPG now accepts a space separated fingerprint as a user ID.  This
+   allows to copy and paste the fingerprint from the key listing.
+
 
 Noteworthy changes in version 2.1.0beta3 (2011-12-20)
 -----------------------------------------------------
diff --git a/common/userids.c b/common/userids.c
index 8c89c32..2b13445 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -308,6 +308,46 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
               if (i == 20)
                 mode = KEYDB_SEARCH_MODE_FPR20;
             }
+          if (!mode)
+            {
+              /* Still not found.  Now check for a space separated
+                 OpenPGP v4 fingerprint like:
+                   8061 5870 F5BA D690 3336  86D0 F2AD 85AC 1E42 B367
+               */
+              hexlength = strspn (s, " 0123456789abcdefABCDEF");
+              if (s[hexlength] && s[hexlength] != ' ')
+                hexlength = 0; /* Followed by non-space.  */
+              while (hexlength && s[hexlength-1] == ' ')
+                hexlength--;   /* Trim trailing spaces.  */
+              if (hexlength == 50 && (!s[hexlength] || s[hexlength] == ' '))
+                {
+                  int i, c;
+
+                  for (i=0; i < 20; i++)
+                    {
+                      if (i && !(i % 2))
+                        {
+                          if (*s != ' ')
+                            break;
+                          s++;
+                          if (i == 10)
+                            {
+                              if (*s != ' ')
+                                break;
+                              s++;
+                            }
+                        }
+
+                      c = hextobyte(s);
+                      if (c == -1)
+                        break;
+                      desc->u.fpr[i] = c;
+                      s += 2;
+                    }
+                  if (i == 20)
+                    mode = KEYDB_SEARCH_MODE_FPR20;
+                }
+            }
           if (!mode) /* Default to substring search.  */
             {
               desc->exact = 0;
diff --git a/doc/specify-user-id.texi b/doc/specify-user-id.texi
index 7d23ed8..2eee024 100644
--- a/doc/specify-user-id.texi
+++ b/doc/specify-user-id.texi
@@ -6,7 +6,7 @@ are only valid for @command{gpg} others are only good for
 
 @itemize @bullet
 
- at item By key Id. 
+ at item By key Id.
 This format is deduced from the length of the string and its content or
 @code{0x} prefix. The key Id of an X.509 certificate are the low 64 bits
 of its SHA-1 fingerprint.  The use of key Ids is just a shortcut, for
@@ -59,16 +59,17 @@ avoids any ambiguities in case that there are duplicated key IDs.
 @end cartouche
 
 @noindent
-(@command{gpgsm} also accepts colons between each pair of hexadecimal
+ at command{gpgsm} also accepts colons between each pair of hexadecimal
 digits because this is the de-facto standard on how to present X.509
-fingerprints.)
+fingerprints.  @command{gpg} also allows the use of the space
+separated SHA-1 fingerprint as printed by the key listing commands.
 
 @item By exact match on OpenPGP user ID.
 This is denoted by a leading equal sign. It does not make sense for
 X.509 certificates.
 
 @cartouche
- at example 
+ at example
 =Heinrich Heine <heinrichh@@uni-duesseldorf.de>
 @end example
 @end cartouche

-----------------------------------------------------------------------

Summary of changes:
 NEWS                     |    3 +++
 common/userids.c         |   40 ++++++++++++++++++++++++++++++++++++++++
 doc/specify-user-id.texi |    9 +++++----
 3 files changed, 48 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list