From: Marcus Brinkmann Date: Wed, 8 May 2002 03:06:16 +0000 (+0000) Subject: 2002-05-08 Marcus Brinkmann X-Git-Tag: gpgme-0-3-7~31 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=39a679ed750419fba616f06379de522871f46e9c;p=gpgme.git 2002-05-08 Marcus Brinkmann * gpgsm/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 c21b81b..8087dfb 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2002-05-08 Marcus Brinkmann + + * gpgsm/t-verify.c (validity_string): New. + (print_sig_stat): Print expire time and validity. + (status_string): Add new exipred stati. + 2002-05-03 Werner Koch * gpg/t-verify.c (validity_string): New. diff --git a/tests/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c index 0fe94a2..fcd1c67 100644 --- a/tests/gpgsm/t-verify.c +++ b/tests/gpgsm/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. * @@ -62,6 +62,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; @@ -78,6 +84,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 ) @@ -90,9 +114,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 );