From 4031c42bfd0135874a5b362df175de93a19f1b51 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 19 Aug 2020 13:43:16 +0200 Subject: gpg,gpgsm: Record the creation time of a private key. * sm/call-agent.c (gpgsm_agent_genkey): Pass --timestamp option. (gpgsm_agent_import_key): Ditto. * g10/call-agent.c (agent_genkey): Add arg timestamp and pass it on. (agent_import_key): Ditto. * g10/import.c (transfer_secret_keys): Pass the creation date to the agent. * g10/keygen.c (common_gen): Ditto. -- Having the creation time in the private key file makes it a lot easier to re-create an OpenPGP public keyblock in case it was accidentally lost. Signed-off-by: Werner Koch --- g10/call-agent.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'g10/call-agent.h') diff --git a/g10/call-agent.h b/g10/call-agent.h index 2305f33e0..8f929be27 100644 --- a/g10/call-agent.h +++ b/g10/call-agent.h @@ -190,7 +190,7 @@ gpg_error_t agent_get_keyinfo (ctrl_t ctrl, const char *hexkeygrip, gpg_error_t agent_genkey (ctrl_t ctrl, char **cache_nonce_addr, char **passwd_nonce_addr, const char *keyparms, int no_protection, - const char *passphrase, + const char *passphrase, time_t timestamp, gcry_sexp_t *r_pubkey); /* Read a public key. FROMCARD may be 0, 1, or 2. */ @@ -220,7 +220,8 @@ gpg_error_t agent_keywrap_key (ctrl_t ctrl, int forexport, gpg_error_t agent_import_key (ctrl_t ctrl, const char *desc, char **cache_nonce_addr, const void *key, size_t keylen, int unattended, int force, - u32 *keyid, u32 *mainkeyid, int pubkey_algo); + u32 *keyid, u32 *mainkeyid, int pubkey_algo, + u32 timestamp); /* Receive a key from the agent. */ gpg_error_t agent_export_key (ctrl_t ctrl, const char *keygrip, -- cgit v1.2.3