From: Werner Koch Date: Fri, 3 May 2002 14:07:22 +0000 (+0000) Subject: * gpg/t-verify.c (validity_string): New. X-Git-Tag: V0-3-6~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fb23b0382dee9fc250d28c5f56a8f3fba5155db0;p=gpgme.git * gpg/t-verify.c (validity_string): New. (print_sig_stat): Print expire time and validity. (status_string): Add new exipred stati. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index b2e9925..c21b81b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2002-05-03 Werner Koch + + * gpg/t-verify.c (validity_string): New. + (print_sig_stat): Print expire time and validity. + (status_string): Add new exipred stati. + 2002-04-05 Marcus Brinkmann * gpgsm/Makefile.am (./trustlist.txt): Put more into this file to diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c index 9e1b4bf..35d9558 100644 --- a/tests/gpg/t-verify.c +++ b/tests/gpg/t-verify.c @@ -1,6 +1,6 @@ /* t-verify.c - regression test * Copyright (C) 2000 Werner Koch (dd9jn) - * Copyright (C) 2001 g10 Code GmbH + * Copyright (C) 2001, 2002 g10 Code GmbH * * This file is part of GPGME. * @@ -91,6 +91,12 @@ status_string (GpgmeSigStat status) case GPGME_SIG_STAT_GOOD: s = "Good"; break; + case GPGME_SIG_STAT_GOOD_EXP: + s = "Good but expired"; + break; + case GPGME_SIG_STAT_GOOD_EXPKEY: + s = "Good but key exipired"; + break; case GPGME_SIG_STAT_BAD: s = "Bad"; break; @@ -107,6 +113,24 @@ status_string (GpgmeSigStat status) return s; } +static const char * +validity_string (GpgmeValidity val) +{ + const char *s = "?"; + + switch (val) + { + case GPGME_VALIDITY_UNKNOWN: s = "unknown"; break; + case GPGME_VALIDITY_NEVER: s = "not trusted"; break; + case GPGME_VALIDITY_MARGINAL:s = "marginal trusted"; break; + case GPGME_VALIDITY_FULL: s = "fully trusted"; break; + case GPGME_VALIDITY_UNDEFINED: + case GPGME_VALIDITY_ULTIMATE: + break; + } + return s; +} + static void print_sig_stat ( GpgmeCtx ctx, GpgmeSigStat status ) @@ -119,9 +143,14 @@ print_sig_stat ( GpgmeCtx ctx, GpgmeSigStat status ) printf ("Verification Status: %s\n", status_string (status)); for(idx=0; (s=gpgme_get_sig_status (ctx, idx, &status, &created)); idx++ ) { - printf ("sig %d: created: %lu status: %s\n", idx, (unsigned long)created, + printf ("sig %d: created: %lu expires: %lu status: %s\n", + idx, (unsigned long)created, + gpgme_get_sig_ulong_attr (ctx, idx, GPGME_ATTR_EXPIRE, 0), status_string(status) ); - printf ("sig %d: fpr/keyid=`%s'\n", idx, s ); + printf ("sig %d: fpr/keyid: `%s' validity: %s\n", + idx, s, + validity_string (gpgme_get_sig_ulong_attr + (ctx, idx, GPGME_ATTR_VALIDITY, 0)) ); if ( !gpgme_get_sig_key (ctx, idx, &key) ) { char *p = gpgme_key_get_as_xml ( key ); printf ("sig %d: key object:\n%s\n", idx, p );