From 1943ed5d2cc1c8064be1feb74b9a82a76da9f0c3 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 9 Apr 2002 18:34:38 +0000 Subject: [PATCH] * protect-tool.c (show_file): New. Used as default action. --- agent/ChangeLog | 4 ++++ agent/protect-tool.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/agent/ChangeLog b/agent/ChangeLog index 7299accd2..84ee66462 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,7 @@ +2002-04-05 Werner Koch + + * protect-tool.c (show_file): New. Used as default action. + 2002-03-28 Werner Koch * divert-scd.c (encode_md_for_card): Don't do the pkcs-1 padding, diff --git a/agent/protect-tool.c b/agent/protect-tool.c index e10662880..d783556de 100644 --- a/agent/protect-tool.c +++ b/agent/protect-tool.c @@ -366,6 +366,29 @@ show_shadow_info (const char *fname) } +static void +show_file (const char *fname) +{ + unsigned char *key; + size_t keylen; + char *p; + + key = read_key (fname); + if (!key) + return; + keylen = gcry_sexp_canon_len (key, 0, NULL,NULL); + assert (keylen); + + p = make_advanced (key, keylen); + xfree (key); + if (p) + { + fwrite (p, strlen (p), 1, stdout); + xfree (p); + } +} + + int @@ -424,7 +447,7 @@ main (int argc, char **argv ) else if (cmd == oShowShadowInfo) show_shadow_info (*argv); else - log_info ("no action requested\n"); + show_file (*argv); return 0; }