summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2005-05-20 22:39:36 +0200
committerWerner Koch <wk@gnupg.org>2005-05-20 22:39:36 +0200
commit41862f5f13bef8113cf040ecaba34a35c370eeb3 (patch)
tree8deaa1ca3c63351b2ef028947aa445b422081e9f /agent
parentChanged the scdaemon to handle concurrent sessions. Adjusted (diff)
downloadgnupg2-41862f5f13bef8113cf040ecaba34a35c370eeb3.tar.xz
gnupg2-41862f5f13bef8113cf040ecaba34a35c370eeb3.zip
* protect-tool.c: New option --canonical.
(show_file): Implement it. * keyformat.txt: Define the created-at attribute for keys. * ccid-driver.c: Replaced macro DEBUG_T1 by a new debug level. (parse_ccid_descriptor): Mark SCR335 firmware version 5.18 good. (ccid_transceive): Arghhh. The seqno is another bit in the R-block than in the I block, this was wrong at one place. * scdaemon.c: New options --debug-ccid-driver and --debug-disable-ticker. * app-openpgp.c (do_genkey, do_writekey): Factored code to check for existing key out into .. (does_key_exist): .. New function. * gpg-connect-agent.c (add_definq, show_definq, clear_definq) (handle_inquire): New. (read_and_print_response): Handle INQUIRE command. (main): Implement control commands.
Diffstat (limited to 'agent')
-rw-r--r--agent/ChangeLog7
-rw-r--r--agent/call-scd.c7
-rw-r--r--agent/keyformat.txt9
-rw-r--r--agent/protect-tool.c23
-rw-r--r--agent/protect.c2
5 files changed, 35 insertions, 13 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 00f019ddc..015b0b6d8 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,10 @@
+2005-05-20 Werner Koch <wk@g10code.com>
+
+ * protect-tool.c: New option --canonical.
+ (show_file): Implement it.
+
+ * keyformat.txt: Define the created-at attribute for keys.
+
2005-05-18 Werner Koch <wk@g10code.com>
* divert-scd.c (ask_for_card): Removed the card reset kludge.
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 58dd412f0..fc81e2fa3 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -158,7 +158,7 @@ start_scd (ctrl_t ctrl)
gpg_error_t err = 0;
const char *pgmname;
assuan_context_t ctx;
- const char *argv[4];
+ const char *argv[3];
int no_close_list[3];
int i;
int rc;
@@ -266,9 +266,8 @@ start_scd (ctrl_t ctrl)
pgmname++;
argv[0] = pgmname;
- argv[1] = "--server";
- argv[2] = "--multi-server";
- argv[3] = NULL;
+ argv[1] = "--multi-server";
+ argv[2] = NULL;
i=0;
if (!opt.running_detached)
diff --git a/agent/keyformat.txt b/agent/keyformat.txt
index 7bdb94c0e..2fa53adba 100644
--- a/agent/keyformat.txt
+++ b/agent/keyformat.txt
@@ -30,12 +30,17 @@ Libgcrypt. Here is an example of an unprotected file:
(q #00f7a7c..[some bytes not shown]..61#)
(u #304559a..[some bytes not shown]..9b#)
)
+ (created-at timestamp)
(uri http://foo.bar x-foo:whatever_you_want)
(comment whatever)
)
-"comment" and "uri" are optional. "comment" is currently used to keep
-track of ssh key comments.
+"comment", "created-at" and "uri" are optional. "comment" is
+currently used to keep track of ssh key comments. "created-at" is used
+to keep track of the creation time stamp used with OpenPGP keys; it is
+optional but required for some operations to calculate the fingerprint
+of the key. This timestamp should be a string with the number of
+seconds since Epoch or an ISO time string (yyyymmddThhmmss).
Actually this form should not be used for regular purposes and only
accepted by gpg-agent with the configuration option:
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index c21aa0517..e8f1d2c10 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -60,6 +60,7 @@ enum cmd_and_opt_values
oShadow,
oShowShadowInfo,
oShowKeygrip,
+ oCanonical,
oP12Import,
oP12Export,
@@ -86,6 +87,7 @@ struct rsa_secret_key_s
static const char *opt_homedir;
static int opt_armor;
+static int opt_canonical;
static int opt_store;
static int opt_force;
static int opt_no_fail_on_exist;
@@ -107,6 +109,7 @@ static ARGPARSE_OPTS opts[] = {
{ oVerbose, "verbose", 0, "verbose" },
{ oArmor, "armor", 0, "write output in advanced format" },
+ { oCanonical, "canonical", 0, "write output in canonical format" },
{ oPassphrase, "passphrase", 2, "|STRING|use passphrase STRING" },
{ oProtect, "protect", 256, "protect a private key"},
{ oUnprotect, "unprotect", 256, "unprotect a private key"},
@@ -508,14 +511,21 @@ show_file (const char *fname)
keylen = gcry_sexp_canon_len (key, 0, NULL,NULL);
assert (keylen);
-
- p = make_advanced (key, keylen);
- xfree (key);
- if (p)
+
+ if (opt_canonical)
{
- fwrite (p, strlen (p), 1, stdout);
- xfree (p);
+ fwrite (key, keylen, 1, stdout);
}
+ else
+ {
+ p = make_advanced (key, keylen);
+ if (p)
+ {
+ fwrite (p, strlen (p), 1, stdout);
+ xfree (p);
+ }
+ }
+ xfree (key);
}
static void
@@ -1079,6 +1089,7 @@ main (int argc, char **argv )
{
case oVerbose: opt.verbose++; break;
case oArmor: opt_armor=1; break;
+ case oCanonical: opt_canonical=1; break;
case oHomedir: opt_homedir = pargs.r.ret_str; break;
case oProtect: cmd = oProtect; break;
diff --git a/agent/protect.c b/agent/protect.c
index ae3061c77..658c8c529 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -60,7 +60,7 @@ hash_passphrase (const char *passphrase, int hashalgo,
-/* Calculate the MIC for a private key S-Exp. SHA1HASH should pint to
+/* Calculate the MIC for a private key S-Exp. SHA1HASH should point to
a 20 byte buffer. This function is suitable for any algorithms. */
static int
calculate_mic (const unsigned char *plainkey, unsigned char *sha1hash)