mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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@fifthhorseman.net>
This commit is contained in:
parent
615b9d1fb7
commit
2ddfb5bef9
2 changed files with 15 additions and 0 deletions
10
g10/import.c
10
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue