eid-viewer
eid-viewer library
|
Files | |
file | certhelpers.h |
Certificate helper functions. Linux/OSX only. | |
file | verify_cert.h |
Helper functions to deal with certificate validation using OpenSSL. Linux/OSX only. | |
Enumerations | |
enum | dump_type { DUMP_DER , DUMP_PEM } |
Functions | |
DllExport char * | eid_vwr_get_use_flags (const char *label, X509 *cert) |
Get the X.509v3 Key Usage field of the given certificate. More... | |
DllExport char * | eid_vwr_detail_cert (const char *label, X509 *cert) |
Get a printable version of the certificate's distinguished name (DN). More... | |
DllExport char * | eid_vwr_describe_cert (const char *label, X509 *cert) |
Get a useful label for the certificate. More... | |
DllExport void | eid_vwr_dumpcert (int fd, const void *derdata, int len, enum dump_type how) |
Write the given certificate to a file descriptor. More... | |
DllExport enum eid_vwr_result | eid_vwr_verify_cert (const void *certificate, size_t certlen, const void *ca, size_t calen, const void *(*perform_ocsp_request)(char *, void *, long, long *, void **), void(*free_ocsp_request)(void *)) |
Verify the validity of a leaf certificate. More... | |
DllExport enum eid_vwr_result | eid_vwr_verify_cert_full (const void *certificate, size_t certlen, const void *ca, size_t calen, const void *(*perform_ocsp_request)(char *, void *, long, long *, void **), void(*free_ocsp_request)(void *), uint64_t flags) |
Verify the validity of a leaf certificate, specifying options. More... | |
DllExport enum eid_vwr_result | eid_vwr_verify_int_cert (const void *certificate, size_t certlen, const void *root, size_t rootlen, const void *(*perform_http_request)(char *, long *, void **), void(free_http_request)(void *)) |
Verify the validity of an intermediate certificate. More... | |
DllExport enum eid_vwr_result | eid_vwr_verify_rrncert (const void *certificate, size_t certlen, const void *root_cert, size_t rootlen) |
Verify the validity of the RRN certificate. More... | |
DllExport enum eid_vwr_result | eid_vwr_verify_root_cert (const void *certificate, size_t certlen) |
Verify the validity of the root certificate. More... | |
DllExport char * | eid_vwr_x509_get_details (const void *certificate, size_t certlen) |
Produce a human-readable version of the certificate. More... | |
DllExport void | eid_vwr_check_signature (const void *pubkey, size_t pubkeylen, const void *signature, size_t siglen, const void *data, size_t datalen) |
helper function to verify that an ECDSA signature is correct. More... | |
These functions are available on GNU/Linux and OS X only.
enum dump_type |
DllExport void eid_vwr_check_signature | ( | const void * | pubkey, |
size_t | pubkeylen, | ||
const void * | signature, | ||
size_t | siglen, | ||
const void * | data, | ||
size_t | datalen | ||
) |
helper function to verify that an ECDSA signature is correct.
pubkey | the public (ECDSA) key to be used, in X9.62 raw format |
pubkeylen | the length of pubkey |
signature | the signature to verify |
siglen | the length of signature |
DllExport char* eid_vwr_describe_cert | ( | const char * | label, |
X509 * | cert | ||
) |
Get a useful label for the certificate.
label | a fallback label, to be used if nothing better can be found |
cert | the certificate to parse |
DllExport char* eid_vwr_detail_cert | ( | const char * | label, |
X509 * | cert | ||
) |
Get a printable version of the certificate's distinguished name (DN).
label | not used |
cert | the certificate to parse |
DllExport void eid_vwr_dumpcert | ( | int | fd, |
const void * | derdata, | ||
int | len, | ||
enum dump_type | how | ||
) |
Write the given certificate to a file descriptor.
fd | the filedescriptor to write to |
derdata | the certificate in DER format |
len | the length in bytes of the preceding parameter |
how | which format to use when writing |
DllExport char* eid_vwr_get_use_flags | ( | const char * | label, |
X509 * | cert | ||
) |
Get the X.509v3 Key Usage field of the given certificate.
label | not used |
cert | the certificate to parse |
DllExport enum eid_vwr_result eid_vwr_verify_cert | ( | const void * | certificate, |
size_t | certlen, | ||
const void * | ca, | ||
size_t | calen, | ||
const void *(*)(char *, void *, long, long *, void **) | perform_ocsp_request, | ||
void(*)(void *) | free_ocsp_request | ||
) |
Verify the validity of a leaf certificate.
This function will verify the validity of a leaf certificate by checking signatures, ensuring they're signed by a valid root certificate, and performing an OCSP request against the OCSP server.
certificate | the X.509 certificate to check, in DER format. |
certlen | the length (in bytes) of certificate. |
ca | the CA certificate by which the certificate is signed |
calen | the length (in bytes) of ca |
perform_ocsp_request | a pointer to a function which should perform an HTTP POST request and return the reply. It should return the data as returned by the OCSP server. Its parameters are:
|
free_ocsp_request | called when the return value of perform_ocsp_request is no longer needed. Its parameter will be the data which was returned in perform_ocsp_request's last parameter. |
DllExport enum eid_vwr_result eid_vwr_verify_cert_full | ( | const void * | certificate, |
size_t | certlen, | ||
const void * | ca, | ||
size_t | calen, | ||
const void *(*)(char *, void *, long, long *, void **) | perform_ocsp_request, | ||
void(*)(void *) | free_ocsp_request, | ||
uint64_t | flags | ||
) |
Verify the validity of a leaf certificate, specifying options.
This function will do the same thing as eid_vwr_verify_cert(), except that it allows to specify options through the "flags" parameter.
Valid options include:
DllExport enum eid_vwr_result eid_vwr_verify_int_cert | ( | const void * | certificate, |
size_t | certlen, | ||
const void * | root, | ||
size_t | rootlen, | ||
const void *(*)(char *, long *, void **) | perform_http_request, | ||
void(free_http_request)(void *) | |||
) |
Verify the validity of an intermediate certificate.
This function will verify the validity of an intermediate certificate by checking signatures, ensuring they're signed by a valid root certificate, and performing a CRL check against the correct CRL.
certificate | the X.509 certificate to check, in DER format. |
certlen | the length (in bytes) of certificate. |
root | the root certificate by which the certificate is signed |
rootlen | the length (in bytes) of root. |
perform_http_request | a pointer to a function which should perform an HTTP GET request and return the reply. It should return the data as returned by the webserver in question. Its parameters are:
|
free_http_request | called when the return value of perform_http_request is no longer needed. Its parameter will be the data which was returned in perform_http_request's last parameter. |
DllExport enum eid_vwr_result eid_vwr_verify_root_cert | ( | const void * | certificate, |
size_t | certlen | ||
) |
Verify the validity of the root certificate.
This function will verify the validity of the root certificate by checking if the certificate can be found in the trust store.
certificate | the X.509 certificate to check, in DER format |
certlen | the length (in bytes) of certificate. |
DllExport enum eid_vwr_result eid_vwr_verify_rrncert | ( | const void * | certificate, |
size_t | certlen, | ||
const void * | root_cert, | ||
size_t | rootlen | ||
) |
Verify the validity of the RRN certificate.
This function will verify the validity of the RRN certificate by checking that the certificate is signed by a valid root certificate.
certificate | the X.509 certificate to check, in DER format. |
certlen | the length (in bytes) of certificate. |
DllExport char* eid_vwr_x509_get_details | ( | const void * | certificate, |
size_t | certlen | ||
) |
Produce a human-readable version of the certificate.
This function will call OpenSSL's X509_print_ex() function on the given certificate which produces the output as produced by the command-line call "openssl x509 -in <certificate> -text".
certificate | the certificate for which to get details |
certlen | the length of certificate |