aboutsummaryrefslogtreecommitdiffstats
path: root/tests/run-verify.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-verify.c')
-rw-r--r--tests/run-verify.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/run-verify.c b/tests/run-verify.c
index b49ea2ab..b7be3203 100644
--- a/tests/run-verify.c
+++ b/tests/run-verify.c
@@ -36,6 +36,15 @@
static int verbose;
+static gpg_error_t
+status_cb (void *opaque, const char *keyword, const char *value)
+{
+ (void)opaque;
+ fprintf (stderr, "status_cb: %s %s\n", keyword, value);
+ return 0;
+}
+
+
static void
print_summary (gpgme_sigsum_t summary)
{
@@ -102,8 +111,10 @@ print_result (gpgme_verify_result_t result)
printf (" validity ..: ");
print_validity (sig->validity); putchar ('\n');
printf (" val.reason : %s\n", gpgme_strerror (sig->status));
- printf (" pubkey algo: %d\n", sig->pubkey_algo);
- printf (" digest algo: %d\n", sig->hash_algo);
+ printf (" pubkey algo: %d (%s)\n", sig->pubkey_algo,
+ nonnull(gpgme_pubkey_algo_name (sig->pubkey_algo)));
+ printf (" digest algo: %d (%s)\n", sig->hash_algo,
+ nonnull(gpgme_hash_algo_name (sig->hash_algo)));
printf (" pka address: %s\n", nonnull (sig->pka_address));
printf (" pka trust .: %s\n",
sig->pka_trust == 0? "n/a" :
@@ -126,6 +137,7 @@ show_usage (int ex)
fputs ("usage: " PGM " [options] [DETACHEDSIGFILE] FILE\n\n"
"Options:\n"
" --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
, stderr);
@@ -145,6 +157,7 @@ main (int argc, char **argv)
FILE *fp_msg = NULL;
gpgme_data_t msg = NULL;
gpgme_verify_result_t result;
+ int print_status = 0;
if (argc)
{ argc--; argv++; }
@@ -164,6 +177,11 @@ main (int argc, char **argv)
verbose = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--status"))
+ {
+ print_status = 1;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--openpgp"))
{
protocol = GPGME_PROTOCOL_OpenPGP;
@@ -207,6 +225,11 @@ main (int argc, char **argv)
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_protocol (ctx, protocol);
+ if (print_status)
+ {
+ gpgme_set_status_cb (ctx, status_cb, NULL);
+ gpgme_set_ctx_flag (ctx, "full-status", "1");
+ }
err = gpgme_data_new_from_stream (&sig, fp_sig);
if (err)
@@ -232,7 +255,7 @@ main (int argc, char **argv)
print_result (result);
if (err)
{
- fprintf (stderr, PGM ": signing failed: %s\n", gpgme_strerror (err));
+ fprintf (stderr, PGM ": verify failed: %s\n", gpgme_strerror (err));
exit (1);
}