aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-09-07 08:34:05 +0000
committerWerner Koch <[email protected]>2022-09-07 09:54:23 +0000
commit0988e49c45d0fb73d0b536aa027bd114f9dc65a7 (patch)
treef9ba57bdd4cc4aa1aa647508ecbd9739a905ebae /g10/getkey.c
parenttools:gpg-auth: Support use of pinpad. (diff)
downloadgnupg-0988e49c45d0fb73d0b536aa027bd114f9dc65a7.tar.gz
gnupg-0988e49c45d0fb73d0b536aa027bd114f9dc65a7.zip
gpg: Support key flags for RENC, TIME, and GROUP.
* g10/packet.h (PUBKEY_USAGE_RENC): New. (PUBKEY_USAGE_TIME): New. (PUBKEY_USAGE_GROUP): New. * g10/getkey.c (parse_key_usage): Set the new key flags. * g10/keyedit.c (show_key_with_all_names_colon): Show the new key flags. * g10/keyid.c (usagestr_from_pk): Ditto * g10/keylist.c (print_capabilities): Ditto. * g10/keygen.c (parse_usagestr): Parse line and set new flags. (quickgen_set_para): Show flags. -- See draft-koch-openpgp-2015-rfc4880bis-00 for the current version. Actually these flags have been in the draft for years now. This patch is a first step to make use of them.
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index e49718e68..3772a8505 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -2457,11 +2457,29 @@ parse_key_usage (PKT_signature * sig)
flags &= ~0x20;
}
+ if ((flags & 0x80))
+ {
+ key_usage |= PUBKEY_USAGE_GROUP;
+ flags &= ~0x80;
+ }
+
if (flags)
key_usage |= PUBKEY_USAGE_UNKNOWN;
+ n--;
+ p++;
+ if (n)
+ {
+ flags = *p;
+ if ((flags & 0x04))
+ key_usage |= PUBKEY_USAGE_RENC;
+ if ((flags & 0x08))
+ key_usage |= PUBKEY_USAGE_TIME;
+ }
+
if (!key_usage)
key_usage |= PUBKEY_USAGE_NONE;
+
}
else if (p) /* Key flags of length zero. */
key_usage |= PUBKEY_USAGE_NONE;