source: creddy/verify.c @ 784a398

abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change on this file since 784a398 was 784a398, checked in by Mike Ryan <mikeryan@…>, 14 years ago

creddy verify, all creddy commands done

  • Property mode set to 100644
File size: 933 bytes
Line 
1#include "creddy.h"
2
3void verify_main(options_t *opts) {
4    certificate_t *subject_cert = NULL;
5
6    if (opts->cert == NULL)
7        usage(opts);
8
9    certificate_t *cert = cert_from_file(opts->cert);
10
11    if (opts->attrcert != NULL)
12        subject_cert = attr_cert_from_file(opts->attrcert);
13    else
14        subject_cert = cert;
15
16    int good = 0;
17    if (subject_cert->issued_by(subject_cert, cert))
18        if (subject_cert->get_validity(subject_cert, NULL, NULL, NULL))
19            if (cert->get_validity(cert, NULL, NULL, NULL)) {
20                puts("signature good, certificates valid");
21                good = 1;
22            }
23            else
24                puts("signature good, issuer cert not valid now");
25        else
26            puts("certificate not valid now");
27    else
28        puts("signature invalid");
29
30    if (subject_cert != cert)
31        DESTROY_IF(subject_cert);
32    DESTROY_IF(cert);
33
34    exit(good);
35}
Note: See TracBrowser for help on using the repository browser.