Mercurial > trustbridge > trustbridge
diff common/certhelp.h @ 1288:265583011f24
(issue123) Add possibility to open native certificate dialog
This is currently only implemented for windows.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 29 Sep 2014 13:12:58 +0200 |
parents | 3cd8dd706aaa |
children |
line wrap: on
line diff
--- a/common/certhelp.h Mon Sep 29 13:02:41 2014 +0200 +++ b/common/certhelp.h Mon Sep 29 13:12:58 2014 +0200 @@ -24,6 +24,12 @@ #define CERT_OID_O (unsigned char *)OID_AT_ORGANIZATION "\0" #define CERT_OID_OU (unsigned char *)OID_AT_ORG_UNIT "\0" #define CERT_OID_SN (unsigned char *)OID_AT_SERIAL_NUMBER "\0" + +#ifdef WIN32 +#include <windows.h> +#include <wincrypt.h> +#endif + #ifdef __cplusplus extern "C" { #endif @@ -58,6 +64,23 @@ */ char *x509_parse_subject(unsigned char *derdata, size_t derlen, unsigned char *oid); + +#ifdef WIN32 +/** + * @brief Parse a X509 ASN encoded base64 encoded certificate. + * + * This function creates a Windows cert contect for the certificate + * encoded in b64_data. The new certificate has to be freed with + * CertFreeCertificateContext. + * + * @param[in] b64_data pointer to the certificate data. + * @param[in] b64_size sizeof the the data. (Without terminating \0) + * + * @returns NULL on error. + */ +PCCERT_CONTEXT b64_to_cert_context(char *b64_data, size_t b64_size); +#endif + #ifdef __cplusplus } #endif