mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
agent: Add optional ecdh parameter arg to KEYTOCARD.
* agent/command.c (KEYTOCARD_TIMESTAMP_FORMAT): Remove and use format string direct. (cmd_keytocard): Change timestamp to an u64 and use the new u64 parser functions. Use split_fields. Add ecdh parameter stuff. Take the default timestamp from the keyfile. * agent/findkey.c (agent_key_from_file): Add arg timestamp and set it. Adjust all callers. -- This is backport from 2.4 but only the agent part. We consider it more relibale if we also pass the ECDH parameters along in 2.2. Adding the timestamp stuff should not harm either. Because we now have the u64 time string parser, we use them here. See-commit:c03ba92576
See-commit:c795be79c1
This patch is somewhat related to: GnuPG-bug-id: 6378, 5538
This commit is contained in:
parent
5da8fe1c40
commit
d03d0add12
5 changed files with 133 additions and 77 deletions
|
@ -889,20 +889,24 @@ 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,
|
||||
uint64_t *r_timestamp)
|
||||
{
|
||||
gpg_error_t err;
|
||||
unsigned char *buf;
|
||||
size_t len, buflen, erroff;
|
||||
gcry_sexp_t s_skey;
|
||||
nvc_t keymeta = NULL;
|
||||
|
||||
*result = NULL;
|
||||
if (shadow_info)
|
||||
*shadow_info = NULL;
|
||||
if (r_passphrase)
|
||||
*r_passphrase = NULL;
|
||||
if (r_timestamp)
|
||||
*r_timestamp = (uint64_t)(-1);
|
||||
|
||||
err = read_key_file (grip, &s_skey, NULL);
|
||||
err = read_key_file (grip, &s_skey, &keymeta);
|
||||
if (err)
|
||||
{
|
||||
if (gpg_err_code (err) == GPG_ERR_ENOENT)
|
||||
|
@ -915,7 +919,19 @@ agent_key_from_file (ctrl_t ctrl, const char *cache_nonce,
|
|||
now. */
|
||||
err = make_canon_sexp (s_skey, &buf, &len);
|
||||
if (err)
|
||||
return err;
|
||||
{
|
||||
nvc_release (keymeta);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (r_timestamp && keymeta)
|
||||
{
|
||||
const char *created = nvc_get_string (keymeta, "Created:");
|
||||
|
||||
if (created)
|
||||
*r_timestamp = isotime2epoch_u64 (created);
|
||||
}
|
||||
nvc_release (keymeta);
|
||||
|
||||
switch (agent_private_key_type (buf))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue