summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2022-12-01 10:10:19 +0100
committerWerner Koch <wk@gnupg.org>2022-12-01 10:12:21 +0100
commite094616cb75d7a4b551ae3db9ea1d5073e3237b6 (patch)
treebb12b1db6f114c981578464027b0b733f1f83df5 /agent
parentgpgsm: Change default algo to AES-256. (diff)
downloadgnupg2-e094616cb75d7a4b551ae3db9ea1d5073e3237b6.tar.xz
gnupg2-e094616cb75d7a4b551ae3db9ea1d5073e3237b6.zip
agent: Fix import of protected v5 keys.
* agent/cvt-openpgp.c (convert_from_openpgp_main): Take care of version 5 keys. -- GnuPG-bug-id: 6294
Diffstat (limited to 'agent')
-rw-r--r--agent/cvt-openpgp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/agent/cvt-openpgp.c b/agent/cvt-openpgp.c
index 76932a7a8..d170fdedc 100644
--- a/agent/cvt-openpgp.c
+++ b/agent/cvt-openpgp.c
@@ -802,9 +802,10 @@ convert_from_openpgp_main (ctrl_t ctrl, gcry_sexp_t s_pgp, int dontcare_exist,
if (!list)
goto bad_seckey;
value = gcry_sexp_nth_data (list, 1, &valuelen);
- if (!value || valuelen != 1 || !(value[0] == '3' || value[0] == '4'))
+ if (!value || valuelen != 1
+ || !(value[0] == '3' || value[0] == '4' || value[0] == '5'))
goto bad_seckey;
- is_v4 = (value[0] == '4');
+ is_v4 = (value[0] == '4' || value[0] == '5');
gcry_sexp_release (list);
list = gcry_sexp_find_token (top_list, "protection", 0);
@@ -948,7 +949,7 @@ convert_from_openpgp_main (ctrl_t ctrl, gcry_sexp_t s_pgp, int dontcare_exist,
gcry_sexp_release (top_list); top_list = NULL;
#if 0
- log_debug ("XXX is_v4=%d\n", is_v4);
+ log_debug ("XXX is v4_or_later=%d\n", is_v4);
log_debug ("XXX pubkey_algo=%d\n", pubkey_algo);
log_debug ("XXX is_protected=%d\n", is_protected);
log_debug ("XXX protect_algo=%d\n", protect_algo);