[git] GnuPG - branch, master, updated. gnupg-2.2.7-147-g2ddfb5b

by Daniel Kahn Gillmor cvs at cvs.gnupg.org
Tue Jun 12 08:19:49 CEST 2018


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  2ddfb5bef920919443309ece9fa2930282bbce85 (commit)
      from  615b9d1fb779f3d5593484aa1e023b0ddff459f0 (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 2ddfb5bef920919443309ece9fa2930282bbce85
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Tue Jun 12 00:41:59 2018 -0400

    gpg: Add new usage option for drop-subkey filters.
    
    * g10/import.c (impex_filter_getval): Add new "usage" property for
    drop-subkey filter.
    --
    
    For example, this permits extraction of only encryption-capable
    subkeys like so:
    
        gpg --export-filter 'drop-subkey=usage !~ e' --export $FPR
    
    GnuPG-Bug-id: 4019
    Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>

diff --git a/doc/gpg.texi b/doc/gpg.texi
index 5f114c5..4cfd000 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2428,6 +2428,11 @@ The available properties are:
   Boolean indicating whether a key or subkey is a secret one.
   (drop-subkey)
 
+  @item usage
+  A string indicating the usage flags for the subkey, from the
+  sequence ``ecsa?''.  For example, a subkey capable of just signing
+  and authentication would be an exact match for ``sa''. (drop-subkey)
+
   @item sig_created
   @itemx sig_created_d
   The first is the timestamp a signature packet was created.  The
diff --git a/g10/import.c b/g10/import.c
index 1a98e2a..2803997 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -1314,6 +1314,16 @@ impex_filter_getval (void *cookie, const char *propname)
         {
           result = pk_is_disabled (pk)? "1":"0";
         }
+      else if (!strcmp (propname, "usage"))
+        {
+          snprintf (numbuf, sizeof numbuf, "%s%s%s%s%s",
+                    (pk->pubkey_usage & PUBKEY_USAGE_ENC)?"e":"",
+                    (pk->pubkey_usage & PUBKEY_USAGE_SIG)?"s":"",
+                    (pk->pubkey_usage & PUBKEY_USAGE_CERT)?"c":"",
+                    (pk->pubkey_usage & PUBKEY_USAGE_AUTH)?"a":"",
+                    (pk->pubkey_usage & PUBKEY_USAGE_UNKNOWN)?"?":"");
+          result = numbuf;
+        }
       else
         result = NULL;
     }

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

Summary of changes:
 doc/gpg.texi |  5 +++++
 g10/import.c | 10 ++++++++++
 2 files changed, 15 insertions(+)


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




More information about the Gnupg-commits mailing list