summaryrefslogtreecommitdiffstats
path: root/sm/certdump.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-10-31 13:12:47 +0100
committerWerner Koch <wk@gnupg.org>2003-10-31 13:12:47 +0100
commitdd808fa15bd93656bae7a70a463da0bdddace254 (patch)
tree490fec85d30971a6af71877f8fcdcbd85571b2c9 /sm/certdump.c
parent* apdu.c (close_ct_reader, close_pcsc_reader): Implemented. (diff)
downloadgnupg2-dd808fa15bd93656bae7a70a463da0bdddace254.tar.xz
gnupg2-dd808fa15bd93656bae7a70a463da0bdddace254.zip
* verify.c (strtimestamp_r, gpgsm_verify):
* sign.c (gpgsm_sign): * keylist.c (print_time, list_cert_std, list_cert_colon): * certdump.c (gpgsm_print_time, gpgsm_dump_time, gpgsm_dump_cert): * certchain.c (gpgsm_validate_chain): Changed to use ksba_isotime_t.
Diffstat (limited to 'sm/certdump.c')
-rw-r--r--sm/certdump.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/sm/certdump.c b/sm/certdump.c
index 703e07186..f06cc5832 100644
--- a/sm/certdump.c
+++ b/sm/certdump.c
@@ -93,42 +93,22 @@ gpgsm_dump_serial (KsbaConstSexp p)
}
void
-gpgsm_print_time (FILE *fp, time_t t)
+gpgsm_print_time (FILE *fp, ksba_isotime_t t)
{
- if (!t)
+ if (!t || !*t)
fputs (_("none"), fp);
- else if ( t == (time_t)(-1) )
- fputs ("[Error - Invalid time]", fp);
else
- {
- struct tm *tp;
-
- tp = gmtime (&t);
- fprintf (fp, "%04d-%02d-%02d %02d:%02d:%02d Z",
- 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
- tp->tm_hour, tp->tm_min, tp->tm_sec);
- assert (!tp->tm_isdst);
- }
+ fprintf (fp, "%.4s-%.2s-%.2s %.2s:%.2s:%s", t, t+4, t+6, t+9, t+11, t+13);
}
void
-gpgsm_dump_time (time_t t)
+gpgsm_dump_time (ksba_isotime_t t)
{
-
- if (!t)
+ if (!t || !*t)
log_printf (_("[none]"));
- else if ( t == (time_t)(-1) )
- log_printf (_("[error]"));
else
- {
- struct tm *tp;
-
- tp = gmtime (&t);
- log_printf ("%04d-%02d-%02d %02d:%02d:%02d",
- 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
- tp->tm_hour, tp->tm_min, tp->tm_sec);
- assert (!tp->tm_isdst);
- }
+ log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s",
+ t, t+4, t+6, t+9, t+11, t+13);
}
@@ -167,7 +147,7 @@ gpgsm_dump_cert (const char *text, KsbaCert cert)
KsbaSexp sexp;
unsigned char *p;
char *dn;
- time_t t;
+ ksba_isotime_t t;
log_debug ("BEGIN Certificate `%s':\n", text? text:"");
if (cert)
@@ -178,11 +158,11 @@ gpgsm_dump_cert (const char *text, KsbaCert cert)
ksba_free (sexp);
log_printf ("\n");
- t = ksba_cert_get_validity (cert, 0);
+ ksba_cert_get_validity (cert, 0, t);
log_debug (" notBefore: ");
gpgsm_dump_time (t);
log_printf ("\n");
- t = ksba_cert_get_validity (cert, 1);
+ ksba_cert_get_validity (cert, 1, t);
log_debug (" notAfter: ");
gpgsm_dump_time (t);
log_printf ("\n");