#include "includes.h"
#include "common.h"
#include "crypto/crypto.h"
#include "asn1.h"
#include "x509v3.h"
Go to the source code of this file.
Functions | |
void | x509_certificate_chain_free (struct x509_certificate *cert) |
void | x509_certificate_free (struct x509_certificate *cert) |
static void | x509_free_name (struct x509_name *name) |
int | x509_name_compare (struct x509_name *a, struct x509_name *b) |
static int | x509_parse_algorithm_identifier (const u8 *buf, size_t len, struct x509_algorithm_identifier *id, const u8 **next) |
static int | x509_parse_name (const u8 *buf, size_t len, struct x509_name *name, const u8 **next) |
static int | x509_parse_public_key (const u8 *buf, size_t len, struct x509_certificate *cert, const u8 **next) |
static int | x509_str_compare (const char *a, const char *b) |
static void | x509_str_strip_whitespace (char *a) |
static int | x509_whitespace (char c) |
: Name to convert | |
int | x509_certificate_chain_validate (struct x509_certificate *trusted, struct x509_certificate *chain, int *reason) |
int | x509_certificate_check_signature (struct x509_certificate *issuer, struct x509_certificate *cert) |
struct x509_certificate * | x509_certificate_parse (const u8 *buf, size_t len) |
static int | x509_digest_oid (struct asn1_oid *oid) |
static int | x509_id_ce_oid (struct asn1_oid *oid) |
void | x509_name_string (struct x509_name *name, char *buf, size_t len) |
static int | x509_parse_alt_name_dns (struct x509_name *name, const u8 *pos, size_t len) |
static int | x509_parse_alt_name_ip (struct x509_name *name, const u8 *pos, size_t len) |
static int | x509_parse_alt_name_rfc8222 (struct x509_name *name, const u8 *pos, size_t len) |
static int | x509_parse_alt_name_rid (struct x509_name *name, const u8 *pos, size_t len) |
static int | x509_parse_alt_name_uri (struct x509_name *name, const u8 *pos, size_t len) |
static int | x509_parse_ext_alt_name (struct x509_name *name, const u8 *pos, size_t len) |
static int | x509_parse_ext_basic_constraints (struct x509_certificate *cert, const u8 *pos, size_t len) |
static int | x509_parse_ext_issuer_alt_name (struct x509_certificate *cert, const u8 *pos, size_t len) |
static int | x509_parse_ext_key_usage (struct x509_certificate *cert, const u8 *pos, size_t len) |
static int | x509_parse_ext_subject_alt_name (struct x509_certificate *cert, const u8 *pos, size_t len) |
static int | x509_parse_extension (struct x509_certificate *cert, const u8 *pos, size_t len, const u8 **next) |
static int | x509_parse_extension_data (struct x509_certificate *cert, struct asn1_oid *oid, const u8 *pos, size_t len) |
static int | x509_parse_extensions (struct x509_certificate *cert, const u8 *pos, size_t len) |
static int | x509_parse_tbs_certificate (const u8 *buf, size_t len, struct x509_certificate *cert, const u8 **next) |
static int | x509_parse_time (const u8 *buf, size_t len, u8 asn1_tag, os_time_t *val) |
static int | x509_parse_validity (const u8 *buf, size_t len, struct x509_certificate *cert, const u8 **next) |
static int | x509_pkcs_oid (struct asn1_oid *oid) |
static int | x509_rsadsi_oid (struct asn1_oid *oid) |
static int | x509_sha1_oid (struct asn1_oid *oid) |
static int | x509_sha256_oid (struct asn1_oid *oid) |
static int | x509_valid_issuer (const struct x509_certificate *cert) |
: Subject name to search for | |
struct x509_certificate * | x509_certificate_get_subject (struct x509_certificate *chain, struct x509_name *name) |
int | x509_certificate_self_signed (struct x509_certificate *cert) |
void x509_certificate_chain_free | ( | struct x509_certificate * | cert | ) |
int x509_certificate_chain_validate | ( | struct x509_certificate * | trusted, | |
struct x509_certificate * | chain, | |||
int * | reason | |||
) |
x509_certificate_chain_validate - Validate X.509 certificate chain : List of trusted certificates : Certificate chain to be validated (first chain must be issued by signed by the second certificate in the chain and so on) : Buffer for returning failure reason (X509_VALIDATE_*) Returns: 0 if chain is valid, -1 if not
int x509_certificate_check_signature | ( | struct x509_certificate * | issuer, | |
struct x509_certificate * | cert | |||
) |
void x509_certificate_free | ( | struct x509_certificate * | cert | ) |
struct x509_certificate* x509_certificate_get_subject | ( | struct x509_certificate * | chain, | |
struct x509_name * | name | |||
) | [read] |
struct x509_certificate* x509_certificate_parse | ( | const u8 * | buf, | |
size_t | len | |||
) | [read] |
x509_certificate_parse - Parse a X.509 certificate in DER format : Pointer to the X.509 certificate in DER format : Buffer length Returns: Pointer to the parsed certificate or NULL on failure
Caller is responsible for freeing the returned certificate by calling x509_certificate_free().
int x509_certificate_self_signed | ( | struct x509_certificate * | cert | ) |
static int x509_digest_oid | ( | struct asn1_oid * | oid | ) | [static] |
static void x509_free_name | ( | struct x509_name * | name | ) | [static] |
static int x509_id_ce_oid | ( | struct asn1_oid * | oid | ) | [static] |
void x509_name_string | ( | struct x509_name * | name, | |
char * | buf, | |||
size_t | len | |||
) |
static int x509_parse_algorithm_identifier | ( | const u8 * | buf, | |
size_t | len, | |||
struct x509_algorithm_identifier * | id, | |||
const u8 ** | next | |||
) | [static] |
static int x509_parse_ext_basic_constraints | ( | struct x509_certificate * | cert, | |
const u8 * | pos, | |||
size_t | len | |||
) | [static] |
static int x509_parse_ext_issuer_alt_name | ( | struct x509_certificate * | cert, | |
const u8 * | pos, | |||
size_t | len | |||
) | [static] |
static int x509_parse_ext_key_usage | ( | struct x509_certificate * | cert, | |
const u8 * | pos, | |||
size_t | len | |||
) | [static] |
static int x509_parse_ext_subject_alt_name | ( | struct x509_certificate * | cert, | |
const u8 * | pos, | |||
size_t | len | |||
) | [static] |
static int x509_parse_extension | ( | struct x509_certificate * | cert, | |
const u8 * | pos, | |||
size_t | len, | |||
const u8 ** | next | |||
) | [static] |
static int x509_parse_extension_data | ( | struct x509_certificate * | cert, | |
struct asn1_oid * | oid, | |||
const u8 * | pos, | |||
size_t | len | |||
) | [static] |
static int x509_parse_extensions | ( | struct x509_certificate * | cert, | |
const u8 * | pos, | |||
size_t | len | |||
) | [static] |
static int x509_parse_public_key | ( | const u8 * | buf, | |
size_t | len, | |||
struct x509_certificate * | cert, | |||
const u8 ** | next | |||
) | [static] |
static int x509_parse_tbs_certificate | ( | const u8 * | buf, | |
size_t | len, | |||
struct x509_certificate * | cert, | |||
const u8 ** | next | |||
) | [static] |
static int x509_parse_validity | ( | const u8 * | buf, | |
size_t | len, | |||
struct x509_certificate * | cert, | |||
const u8 ** | next | |||
) | [static] |
static int x509_pkcs_oid | ( | struct asn1_oid * | oid | ) | [static] |
static int x509_rsadsi_oid | ( | struct asn1_oid * | oid | ) | [static] |
static int x509_sha1_oid | ( | struct asn1_oid * | oid | ) | [static] |
static int x509_sha256_oid | ( | struct asn1_oid * | oid | ) | [static] |
static int x509_str_compare | ( | const char * | a, | |
const char * | b | |||
) | [static] |
static int x509_valid_issuer | ( | const struct x509_certificate * | cert | ) | [static] |