mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
agent: Use "Created:" field for creation time.
* agent/agent.h (agent_key_from_file): Change the declaration. * agent/findkey.c (agent_key_from_file): Return timestamp. * agent/pkdecrypt.c (agent_pkdecrypt): Follow the change. * agent/pksign.c (agent_pkdecrypt): Likewise. * agent/command.c (cmd_passwd, cmd_export_key): Likewise. (cmd_keytocard): Use timestamp in private key file in "Created:". -- GnuPG-bug-id: 5538 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
25d37a0a6a
commit
c795be79c1
5 changed files with 36 additions and 21 deletions
|
@ -981,7 +981,8 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
|
|||
const char *desc_text,
|
||||
const unsigned char *grip, unsigned char **shadow_info,
|
||||
cache_mode_t cache_mode, lookup_ttl_t lookup_ttl,
|
||||
gcry_sexp_t *result, char **r_passphrase)
|
||||
gcry_sexp_t *result, char **r_passphrase,
|
||||
time_t *r_timestamp)
|
||||
{
|
||||
gpg_error_t err;
|
||||
unsigned char *buf;
|
||||
|
@ -995,6 +996,8 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
|
|||
*shadow_info = NULL;
|
||||
if (r_passphrase)
|
||||
*r_passphrase = NULL;
|
||||
if (r_timestamp)
|
||||
*r_timestamp = (time_t)(-1);
|
||||
|
||||
err = read_key_file (grip, &s_skey, &keymeta);
|
||||
if (err)
|
||||
|
@ -1015,6 +1018,14 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
|
|||
return err;
|
||||
}
|
||||
|
||||
if (r_timestamp && keymeta)
|
||||
{
|
||||
const char *created = nvc_get_string (keymeta, "Created:");
|
||||
|
||||
if (created)
|
||||
*r_timestamp = isotime2epoch (created);
|
||||
}
|
||||
|
||||
switch (agent_private_key_type (buf))
|
||||
{
|
||||
case PRIVATE_KEY_CLEAR:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue