#include #include "creddy_common.h" void issuer_main(options_t *opts) { if (opts->cert == NULL) usage(opts); // first try ID cert creddy_id_t *id = creddy_id_from_file(opts->cert); if (id != NULL) { char *issuer = creddy_id_issuer(id); puts(creddy_id_issuer(id)); creddy_id_free(id); return; } // then try attribute cert certificate_t *ac = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509_AC, BUILD_FROM_FILE, opts->cert, BUILD_END ); if (ac != NULL) { printf("%Y\n", ac->get_issuer(ac)); DESTROY_IF(ac); return; } // give up if neither works errx(1, "Couldn't load %s as an ID or attribute cert", opts->cert); }