diff options
author | Ben Kibbey <[email protected]> | 2011-04-10 13:37:18 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2011-04-12 16:00:59 +0000 |
commit | 944bf8f5b550bdbab292e7fadd0016b341c7bef9 (patch) | |
tree | 39f8e34e04f7bcb7cc4ea3c61e43c8af5e2a0fc1 /agent/genkey.c | |
parent | Added KEYINFO field to show the protection type of a key. This differs from t... (diff) | |
download | gnupg-944bf8f5b550bdbab292e7fadd0016b341c7bef9.tar.gz gnupg-944bf8f5b550bdbab292e7fadd0016b341c7bef9.zip |
Added GENKEY --preset to add the passphrase of the generated key to the cache.
Diffstat (limited to 'agent/genkey.c')
-rw-r--r-- | agent/genkey.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/agent/genkey.c b/agent/genkey.c index f70526ddd..95e0a64ce 100644 --- a/agent/genkey.c +++ b/agent/genkey.c @@ -357,7 +357,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt, int agent_genkey (ctrl_t ctrl, const char *cache_nonce, const char *keyparam, size_t keyparamlen, int no_protection, - membuf_t *outbuf) + int preset, membuf_t *outbuf) { gcry_sexp_t s_keyparam, s_key, s_private, s_public; char *passphrase; @@ -434,6 +434,16 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce, && !agent_put_cache (cache_nonce, CACHE_MODE_NONCE, passphrase, 900 /*seconds*/)) agent_write_status (ctrl, "CACHE_NONCE", cache_nonce, NULL); + if (preset && !no_protection) + { + unsigned char grip[20]; + char hexgrip[40+1]; + if (gcry_pk_get_keygrip (s_private, grip)) + { + bin2hex(grip, 20, hexgrip); + rc = agent_put_cache (hexgrip, CACHE_MODE_ANY, passphrase, 900); + } + } } xfree (passphrase); passphrase = NULL; |