mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Merge branch 'master' into key-storage-work
--
This commit is contained in:
commit
eaa6dc3a8b
26 changed files with 484 additions and 261 deletions
|
@ -607,6 +607,10 @@ agent_keytocard (const char *hexgrip, int keyno, int force,
|
|||
{
|
||||
int rc;
|
||||
char line[ASSUAN_LINELENGTH];
|
||||
struct default_inq_parm_s parm;
|
||||
|
||||
memset (&parm, 0, sizeof parm);
|
||||
parm.ctx = agent_ctx;
|
||||
|
||||
snprintf (line, DIM(line)-1, "KEYTOCARD %s%s %s OPENPGP.%d %s",
|
||||
force?"--force ": "", hexgrip, serialno, keyno, timestamp);
|
||||
|
@ -616,8 +620,8 @@ agent_keytocard (const char *hexgrip, int keyno, int force,
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = assuan_transact (agent_ctx, line, NULL, NULL, default_inq_cb,
|
||||
NULL, NULL, NULL);
|
||||
rc = assuan_transact (agent_ctx, line, NULL, NULL, default_inq_cb, &parm,
|
||||
NULL, NULL);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
@ -721,7 +725,7 @@ inq_writecert_parms (void *opaque, const char *line)
|
|||
int rc;
|
||||
struct writecert_parm_s *parm = opaque;
|
||||
|
||||
if (!strncmp (line, "CERTDATA", 8) && (line[8]==' '||!line[8]))
|
||||
if (has_leading_keyword (line, "CERTDATA"))
|
||||
{
|
||||
rc = assuan_send_data (parm->dflt->ctx,
|
||||
parm->certdata, parm->certdatalen);
|
||||
|
@ -774,7 +778,7 @@ inq_writekey_parms (void *opaque, const char *line)
|
|||
int rc;
|
||||
struct writekey_parm_s *parm = opaque;
|
||||
|
||||
if (!strncmp (line, "KEYDATA", 7) && (line[7]==' '||!line[7]))
|
||||
if (has_leading_keyword (line, "KEYDATA"))
|
||||
{
|
||||
rc = assuan_send_data (parm->dflt->ctx, parm->keydata, parm->keydatalen);
|
||||
}
|
||||
|
@ -1467,9 +1471,9 @@ keyinfo_status_cb (void *opaque, const char *line)
|
|||
char **serialno = opaque;
|
||||
const char *s, *s2;
|
||||
|
||||
if (!strncmp (line, "KEYINFO ", 8) && !*serialno)
|
||||
if ((s = has_leading_keyword (line, "KEYINFO ")) && !*serialno)
|
||||
{
|
||||
s = strchr (line+8, ' ');
|
||||
s = strchr (s, ' ');
|
||||
if (s && s[1] == 'T' && s[2] == ' ' && s[3])
|
||||
{
|
||||
s += 3;
|
||||
|
@ -1571,7 +1575,7 @@ inq_genkey_parms (void *opaque, const char *line)
|
|||
struct genkey_parm_s *parm = opaque;
|
||||
gpg_error_t err;
|
||||
|
||||
if (!strncmp (line, "KEYPARAM", 8) && (line[8]==' '||!line[8]))
|
||||
if (has_leading_keyword (line, "KEYPARAM"))
|
||||
{
|
||||
err = assuan_send_data (parm->dflt->ctx,
|
||||
parm->keyparms, strlen (parm->keyparms));
|
||||
|
@ -1798,7 +1802,7 @@ inq_ciphertext_cb (void *opaque, const char *line)
|
|||
struct cipher_parm_s *parm = opaque;
|
||||
int rc;
|
||||
|
||||
if (!strncmp (line, "CIPHERTEXT", 10) && (line[10]==' '||!line[10]))
|
||||
if (has_leading_keyword (line, "CIPHERTEXT"))
|
||||
{
|
||||
assuan_begin_confidential (parm->ctx);
|
||||
rc = assuan_send_data (parm->dflt->ctx,
|
||||
|
@ -1980,7 +1984,7 @@ inq_import_key_parms (void *opaque, const char *line)
|
|||
struct import_key_parm_s *parm = opaque;
|
||||
gpg_error_t err;
|
||||
|
||||
if (!strncmp (line, "KEYDATA", 7) && (line[7]==' '||!line[7]))
|
||||
if (has_leading_keyword (line, "KEYDATA"))
|
||||
{
|
||||
err = assuan_send_data (parm->dflt->ctx, parm->key, parm->keylen);
|
||||
}
|
||||
|
|
|
@ -515,12 +515,12 @@ ks_put_inq_cb (void *opaque, const char *line)
|
|||
struct ks_put_parm_s *parm = opaque;
|
||||
gpg_error_t err = 0;
|
||||
|
||||
if (!strncmp (line, "KEYBLOCK", 8) && (line[8] == ' ' || !line[8]))
|
||||
if (has_leading_keyword (line, "KEYBLOCK"))
|
||||
{
|
||||
if (parm->data)
|
||||
err = assuan_send_data (parm->ctx, parm->data, parm->datalen);
|
||||
}
|
||||
else if (!strncmp (line, "KEYBLOCK_INFO", 13) && (line[13]==' ' || !line[13]))
|
||||
else if (has_leading_keyword (line, "KEYBLOCK_INFO"))
|
||||
{
|
||||
kbnode_t node;
|
||||
estream_t fp;
|
||||
|
|
|
@ -550,7 +550,9 @@ card_status (estream_t fp, char *serialno, size_t serialnobuflen)
|
|||
tty_fprintf (fp, " %u%c",
|
||||
info.key_attr[i].nbits,
|
||||
info.key_attr[i].algo == 1? 'R':
|
||||
info.key_attr[i].algo == 17? 'D': '?');
|
||||
info.key_attr[i].algo == 17? 'D':
|
||||
info.key_attr[i].algo == 18? 'e':
|
||||
info.key_attr[i].algo == 19? 'E': '?');
|
||||
tty_fprintf (fp, "\n");
|
||||
}
|
||||
tty_fprintf (fp, "Max. PIN lengths .: %d %d %d\n",
|
||||
|
@ -1560,7 +1562,7 @@ card_store_subkey (KBNODE node, int use)
|
|||
|
||||
nbits = nbits_from_pk (pk);
|
||||
|
||||
if (!is_RSA (pk->pubkey_algo) || (!info.is_v2 && nbits != 1024) )
|
||||
if (!info.is_v2 && nbits != 1024)
|
||||
{
|
||||
tty_printf ("You may only store a 1024 bit RSA key on the card\n");
|
||||
tty_printf ("\n");
|
||||
|
|
|
@ -1291,13 +1291,19 @@ parse_key_usage (PKT_signature * sig)
|
|||
|
||||
if (flags)
|
||||
key_usage |= PUBKEY_USAGE_UNKNOWN;
|
||||
|
||||
if (!key_usage)
|
||||
key_usage |= PUBKEY_USAGE_NONE;
|
||||
}
|
||||
else if (p) /* Key flags of length zero. */
|
||||
key_usage |= PUBKEY_USAGE_NONE;
|
||||
|
||||
/* We set PUBKEY_USAGE_UNKNOWN to indicate that this key has a
|
||||
capability that we do not handle. This serves to distinguish
|
||||
between a zero key usage which we handle as the default
|
||||
capabilities for that algorithm, and a usage that we do not
|
||||
handle. */
|
||||
handle. Likewise we use PUBKEY_USAGE_NONE to indicate that
|
||||
key_flags have been given but they do not specify any usage. */
|
||||
|
||||
return key_usage;
|
||||
}
|
||||
|
|
|
@ -216,9 +216,6 @@ do_add_key_flags (PKT_signature *sig, unsigned int use)
|
|||
if (use & PUBKEY_USAGE_AUTH)
|
||||
buf[0] |= 0x20;
|
||||
|
||||
if (!buf[0])
|
||||
return;
|
||||
|
||||
build_sig_subpkt (sig, SIGSUBPKT_KEY_FLAGS, buf, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -627,6 +627,9 @@ print_capabilities (PKT_public_key *pk, KBNODE keyblock)
|
|||
if ((use & PUBKEY_USAGE_AUTH))
|
||||
es_putc ('a', es_stdout);
|
||||
|
||||
if ((use & PUBKEY_USAGE_UNKNOWN))
|
||||
es_putc ('?', es_stdout);
|
||||
|
||||
if (keyblock)
|
||||
{
|
||||
/* Figure out the usable capabilities. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue