annotate common/certhelp.h @ 310:f758460ca437

Merged
author Sascha Wilde <wilde@intevation.de>
date Fri, 04 Apr 2014 09:54:19 +0200
parents 20d515604daa
children 2207e94a0cc3
rev   line source
259
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
1 #ifndef CERTHELP_H
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
2 #define CERTHELP_H
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
3
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
4 /* Polarssl mh.h contains a conversion which gcc warns about */
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
5 #pragma GCC diagnostic ignored "-Wsign-conversion"
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
6 #pragma GCC diagnostic ignored "-Wconversion"
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
7 #include <polarssl/oid.h>
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
8 #include <polarssl/x509_crt.h>
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
9 #pragma GCC diagnostic pop
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
10 #pragma GCC diagnostic pop
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
11
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
12 #define CERT_OID_CN (unsigned char *)OID_AT_CN "\0"
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
13 #define CERT_OID_O (unsigned char *)OID_AT_ORGANIZATION "\0"
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
14
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
15 /**
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
16 * @file
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
17 * @brief Helper functinos to handle and parse X.509 certificates.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
18 *
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
19 * Simple helper functions based on PolarSSL.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
20 */
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22 /**
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
23 * @brief Extracts value of an gieb OID from an x509_name object.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
24 *
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
25 * The value is copyed to an bull byte terminated c-string.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 * The caller should free it after use.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27 * @param[in] namebuf ponter to the x509_name object.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
28 * @param[in] oid the oid to search for.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
29 * @returns the extracted String, or NULL in failure.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
30 */
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
31 char *get_oid_valstr(x509_name *namebuf, unsigned char *oid);
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
32
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
33 /**
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34 * @brief Parse x509 certificate and retrieve specified OID from Subject.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
35 *
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
36 * The value is copyed to an bull byte terminated c-string.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
37 * The caller should free it after use.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
38 * @param[in] derdata pointer to certificate in DER format.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
39 * @param[in] derlen length of the DER data.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
40 * @param[in] oid the OID to search for.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
41 * @returns the extracted String, or NULL in failure.
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
42 */
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
43 char *x509_parse_subject(unsigned char *derdata, size_t derlen,
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
44 unsigned char *oid);
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
45
20d515604daa Added new module with helper functions to parse certs.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
46 #endif

http://wald.intevation.org/projects/trustbridge/