From e094616cb75d7a4b551ae3db9ea1d5073e3237b6 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 1 Dec 2022 10:10:19 +0100 Subject: 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 --- agent/cvt-openpgp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'agent') 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); -- cgit v1.2.3