7 #include "wvautoconf.h"
9 void print_details(
WvX509 *x509)
12 wvcon->print(
"Issuer: %s\n", x509->
get_issuer());
13 wvcon->print(
"Serial: %s\n", x509->
get_serial());
15 time_t t2 = x509->get_notvalid_after();
17 wvcon->print(
"Not Valid Before: %s\n", ctime(&t1));
18 wvcon->print(
"Not Valid After: %s\n", ctime(&t2));
21 wvcon->print(
"Authority Info Access: \n%s\n", x509->
get_aia());
24 wvcon->print(
"CA Issuers available from:\n%s\n", list.
join(
"\n"));
27 wvcon->print(
"OCSP Responders available from:\n%s\n", list.
join(
"\n"));
30 wvcon->print(
"CRL Distribution Points:\n%s\n", list.
join(
"\n"));
33 wvcon->print(
"Certificate Policy OIDs:\n%s\n", list.
join(
"\n"));
35 #ifdef HAVE_OPENSSL_POLICY_MAPPING
36 int requireExplicitPolicy, inhibitPolicyMapping;
38 wvcon->print(
"Certificate Policy Constraints: requireExplicitPolicy: %s "
39 "inhibitPolicyMapping: %s\n", requireExplicitPolicy,
40 inhibitPolicyMapping);
42 WvX509::PolicyMapList maplist;
44 wvcon->print(
"Policy mappings:\n");
45 WvX509::PolicyMapList::Iter i(maplist);
46 for (i.rewind(); i.next();)
47 wvcon->print(
"%s -> %s\n", i().issuer_domain, i().subject_domain);
52 int main(
int argc,
char **argv)
54 wvcrash_setup(argv[0]);
61 args.
add_option(
't',
"type",
"Certificate type: der or pem (default: pem)",
63 if (!args.
process(argc, argv, &remaining_args) || remaining_args.count() < 1)
71 if (certtype ==
"der")
72 x509.load(WvX509Mgr::CertDER, remaining_args.
popstr());
73 else if (certtype ==
"pem")
74 x509.load(WvX509Mgr::CertPEM, remaining_args.
popstr());
77 wverr->print(
"Invalid certificate type '%s'\n", certtype);
84 wverr->print(
"X509 certificate not valid\n");