diff options
author | Daniel Kahn Gillmor <[email protected]> | 2018-06-12 04:41:59 +0000 |
---|---|---|
committer | Daniel Kahn Gillmor <[email protected]> | 2018-06-12 04:48:06 +0000 |
commit | e037657edaf0b3ee9d2e30f6fe3edf6879976472 (patch) | |
tree | 8e19619b700c66d5ec0d8f7f33196cf79ab6032e /g10/import.c | |
parent | doc: Mention new command --show-keys in the 2.2.7 NEWS. (diff) | |
download | gnupg-fix-T4019.tar.gz gnupg-fix-T4019.zip |
gpg: Add new usage option for drop-subkey filters.fix-T4019
* 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 <[email protected]>
Diffstat (limited to 'g10/import.c')
-rw-r--r-- | g10/import.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c index 6d2beaf33..b6096608e 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1296,6 +1296,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; } |