[svn] GnuPG - r5440 - in trunk: doc g10 sm

svn author wk cvs at cvs.gnupg.org
Fri Oct 8 13:11:09 CEST 2010


Author: wk
Date: 2010-10-08 13:11:08 +0200 (Fri, 08 Oct 2010)
New Revision: 5440

Modified:
   trunk/doc/gpg.texi
   trunk/doc/gpgsm.texi
   trunk/g10/ChangeLog
   trunk/g10/gpg.c
   trunk/g10/keylist.c
   trunk/g10/options.h
   trunk/sm/ChangeLog
   trunk/sm/gpgsm.c
   trunk/sm/gpgsm.h
   trunk/sm/keylist.c
Log:
Add new option --with-keygrip


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/g10/ChangeLog	2010-10-08 11:11:08 UTC (rev 5440)
@@ -1,3 +1,10 @@
+2010-10-08  Werner Koch  <wk at g10code.com>
+
+	* gpg.c: Add option --with-keygrip.
+	* options.h (struct opt): Add WITH_KEYGRIP.
+	* keylist.c (list_keyblock_print, list_keyblock_colon): Implement
+	new option.
+
 2010-10-06  Werner Koch  <wk at g10code.com>
 
 	* import.c (transfer_secret_keys): Ignore missing key parameters.

Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/sm/ChangeLog	2010-10-08 11:11:08 UTC (rev 5440)
@@ -1,3 +1,9 @@
+2010-10-08  Werner Koch  <wk at g10code.com>
+
+	* gpgsm.c: Add option --with-keygrip.
+	* gpgsm.h (struct opt): Add WITH_KEYGRIP.
+	* keylist.c (list_cert_std): Implement option.
+
 2010-09-16  Werner Koch  <wk at g10code.com>
 
 	* certchain.c (gpgsm_walk_cert_chain): Use GPG_ERR_MISSING_ISSUER_CERT.

Modified: trunk/doc/gpg.texi
===================================================================
--- trunk/doc/gpg.texi	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/doc/gpg.texi	2010-10-08 11:11:08 UTC (rev 5440)
@@ -1945,6 +1945,11 @@
 Same as the command @option{--fingerprint} but changes only the format
 of the output and may be used together with another command.
 
+ at ifset gpgtwoone
+ at item --with-keygrip
+ at opindex with-keygrip
+Include the keygrip in the key listings.
+ at end ifset
 
 @end table
 

Modified: trunk/doc/gpgsm.texi
===================================================================
--- trunk/doc/gpgsm.texi	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/doc/gpgsm.texi	2010-10-08 11:11:08 UTC (rev 5440)
@@ -554,6 +554,10 @@
 For standard key listings, also print the MD5 fingerprint of the
 certificate.
 
+ at item --with-keygrip
+Include the keygrip in standard key listings.  Note that the keygrip is
+always listed in --with-colons mode.
+
 @end table
 
 @c *******************************************

Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/g10/gpg.c	2010-10-08 11:11:08 UTC (rev 5440)
@@ -166,6 +166,7 @@
     oNoAskCertLevel,
     oFingerprint,
     oWithFingerprint,
+    oWithKeygrip,
     oAnswerYes,
     oAnswerNo,
     oKeyring,
@@ -669,6 +670,7 @@
   ARGPARSE_s_n (oUtf8Strings,      "utf8-strings", "@"),
   ARGPARSE_s_n (oNoUtf8Strings, "no-utf8-strings", "@"),
   ARGPARSE_s_n (oWithFingerprint, "with-fingerprint", "@"),
+  ARGPARSE_s_n (oWithKeygrip,     "with-keygrip", "@"),
   ARGPARSE_s_s (oDisableCipherAlgo,  "disable-cipher-algo", "@"),
   ARGPARSE_s_s (oDisablePubkeyAlgo,  "disable-pubkey-algo", "@"),
   ARGPARSE_s_n (oAllowNonSelfsignedUID,      "allow-non-selfsigned-uid", "@"),
@@ -2279,6 +2281,10 @@
             fpr_maybe_cmd = 1;
             break;
 
+	  case oWithKeygrip:
+            opt.with_keygrip = 1;
+            break;
+
 	  case oSecretKeyring:
             /* Ignore this old option.  */
             break;

Modified: trunk/g10/keylist.c
===================================================================
--- trunk/g10/keylist.c	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/g10/keylist.c	2010-10-08 11:11:08 UTC (rev 5440)
@@ -822,6 +822,17 @@
   if (fpr)
     print_fingerprint (pk, 0);
 
+  if (opt.with_keygrip)
+    {
+      char *p;
+
+      if (!hexkeygrip_from_pk (pk, &p))
+        {
+          es_fprintf (es_stdout, "      Keygrip = %s\n", p);
+          xfree (p);
+        }
+    }
+
   /* FIXME: Change this function to take a PK and ask the agent:  */
   /* if (secret) print_card_serialno (sk); */
 
@@ -919,6 +930,16 @@
               /* if (secret) */
               /*   print_card_serialno (sk2); */
             }
+          if (opt.with_keygrip)
+            {
+              char *p;
+              
+              if (!hexkeygrip_from_pk (pk2, &p))
+                {
+                  es_fprintf (es_stdout, "      Keygrip = %s\n", p);
+                  xfree (p);
+                }
+            }
 	  if (opt.with_key_data)
 	    print_key_data (pk2);
 	}
@@ -1131,14 +1152,15 @@
   print_revokers (pk);
   if (fpr)
     print_fingerprint (pk, 0);
-  if (opt.with_key_data)
+  if (opt.with_key_data || opt.with_keygrip)
     {
       if (!hexkeygrip_from_pk (pk, &p))
         {
           es_fprintf (es_stdout, "grp:::::::::%s:\n", p);
           xfree (p);
         }
-      print_key_data (pk);
+      if (opt.with_key_data)
+        print_key_data (pk);
     }
 
   for (kbctx = NULL; (node = walk_kbnode (keyblock, &kbctx, 0));)
@@ -1236,14 +1258,15 @@
 	  es_putc ('\n', es_stdout);
 	  if (fpr > 1)
 	    print_fingerprint (pk2, 0);
-	  if (opt.with_key_data)
+	  if (opt.with_key_data || opt.with_keygrip)
             {
               if (!hexkeygrip_from_pk (pk2, &p))
                 {
                   es_fprintf (es_stdout, "grp:::::::::%s:\n", p);
                   xfree (p);
                 }
-              print_key_data (pk2);
+              if (opt.with_key_data)
+                print_key_data (pk2);
             }
 	}
       else if (opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE)

Modified: trunk/g10/options.h
===================================================================
--- trunk/g10/options.h	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/g10/options.h	2010-10-08 11:11:08 UTC (rev 5440)
@@ -59,7 +59,8 @@
   int check_sigs; /* check key signatures */
   int with_colons;
   int with_key_data;
-  int with_fingerprint; /* opt --with-fingerprint active */
+  int with_fingerprint; /* Option --with-fingerprint active.  */
+  int with_keygrip;     /* Option --with-keygrip active.  */
   int fingerprint; /* list fingerprints */
   int list_sigs;   /* list signatures */
   int no_armor;

Modified: trunk/sm/gpgsm.c
===================================================================
--- trunk/sm/gpgsm.c	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/sm/gpgsm.c	2010-10-08 11:11:08 UTC (rev 5440)
@@ -143,6 +143,7 @@
   
   oWithFingerprint,
   oWithMD5Fingerprint,
+  oWithKeygrip,
   oAnswerYes,
   oAnswerNo,
   oKeyring,
@@ -371,6 +372,7 @@
   ARGPARSE_s_n (oWithEphemeralKeys,  "with-ephemeral-keys", "@"),
   ARGPARSE_s_n (oSkipVerify, "skip-verify", "@"),
   ARGPARSE_s_n (oWithFingerprint, "with-fingerprint", "@"),
+  ARGPARSE_s_n (oWithKeygrip,     "with-keygrip", "@"),
   ARGPARSE_s_s (oDisableCipherAlgo,  "disable-cipher-algo", "@"),
   ARGPARSE_s_s (oDisablePubkeyAlgo,  "disable-pubkey-algo", "@"),
   ARGPARSE_s_n (oIgnoreTimeConflict, "ignore-time-conflict", "@"),
@@ -1244,6 +1246,10 @@
           opt.fingerprint++;
           break;
 
+        case oWithKeygrip:
+          opt.with_keygrip = 1;
+          break;
+
         case oOptions:
           /* config files may not be nested (silently ignore them) */
           if (!configfp)

Modified: trunk/sm/gpgsm.h
===================================================================
--- trunk/sm/gpgsm.h	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/sm/gpgsm.h	2010-10-08 11:11:08 UTC (rev 5440)
@@ -80,6 +80,8 @@
   int with_md5_fingerprint; /* Also print an MD5 fingerprint for
                                standard key listings. */
 
+  int with_keygrip; /* Option --with-keygrip active.  */
+
   int armor;        /* force base64 armoring (see also ctrl.with_base64) */
   int no_armor;     /* don't try to figure out whether data is base64 armored*/
 

Modified: trunk/sm/keylist.c
===================================================================
--- trunk/sm/keylist.c	2010-10-06 11:29:10 UTC (rev 5439)
+++ trunk/sm/keylist.c	2010-10-08 11:11:08 UTC (rev 5440)
@@ -1216,6 +1216,16 @@
   es_fprintf (fp, "  fingerprint: %s\n", dn?dn:"error");
   xfree (dn);
 
+  if (opt.with_keygrip)
+    {
+      dn = gpgsm_get_keygrip_hexstring (cert);
+      if (dn)
+        {
+          es_fprintf (fp, "      keygrip: %s\n", dn);
+          xfree (dn);
+        }
+    }      
+
   if (have_secret)
     {
       char *cardsn;





More information about the Gnupg-commits mailing list