aboutsummaryrefslogtreecommitdiffstats
path: root/agent/findkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-01-29 15:26:07 +0000
committerWerner Koch <[email protected]>2015-01-29 15:26:07 +0000
commit6ab0fac575a8b04152a199cb300a08436b096753 (patch)
tree8a7309b2ef2a8493c1762963fc58049740a60a19 /agent/findkey.c
parentpo: Update Japanese Translation. (diff)
downloadgnupg-6ab0fac575a8b04152a199cb300a08436b096753.tar.gz
gnupg-6ab0fac575a8b04152a199cb300a08436b096753.zip
agent: Fix use of imported but unprotected openpgp keys.
* agent/agent.h (PRIVATE_KEY_OPENPGP_NONE): New. * agent/command.c (do_one_keyinfo): Implement it. * agent/findkey.c (agent_key_from_file): Ditto. (agent_key_info_from_file): Ditto. (agent_delete_key): Ditto. * agent/protect.c (agent_private_key_type): Add detection for openpgp "none" method. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--agent/findkey.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/agent/findkey.c b/agent/findkey.c
index 156102b4e..6f01789cd 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -664,6 +664,22 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
{
case PRIVATE_KEY_CLEAR:
break; /* no unprotection needed */
+ case PRIVATE_KEY_OPENPGP_NONE:
+ {
+ unsigned char *buf_new;
+ size_t buf_newlen;
+
+ rc = agent_unprotect (ctrl, buf, "", NULL, &buf_new, &buf_newlen);
+ if (rc)
+ log_error ("failed to convert unprotected openpgp key: %s\n",
+ gpg_strerror (rc));
+ else
+ {
+ xfree (buf);
+ buf = buf_new;
+ }
+ }
+ break;
case PRIVATE_KEY_PROTECTED:
{
char *desc_text_final;
@@ -1159,6 +1175,7 @@ agent_key_info_from_file (ctrl_t ctrl, const unsigned char *grip,
switch (keytype)
{
case PRIVATE_KEY_CLEAR:
+ case PRIVATE_KEY_OPENPGP_NONE:
break;
case PRIVATE_KEY_PROTECTED:
/* If we ever require it we could retrieve the comment fields
@@ -1230,6 +1247,7 @@ agent_delete_key (ctrl_t ctrl, const char *desc_text,
switch (agent_private_key_type (buf))
{
case PRIVATE_KEY_CLEAR:
+ case PRIVATE_KEY_OPENPGP_NONE:
case PRIVATE_KEY_PROTECTED:
{
bin2hex (grip, 20, hexgrip);