Apache HTTPD
Classes | Macros | Functions | Variables
md_crypt.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <apr_lib.h>
#include <apr_buckets.h>
#include <apr_file_io.h>
#include <apr_strings.h>
#include <httpd.h>
#include <http_core.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/pem.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/x509v3.h>
#include "md.h"
#include "md_crypt.h"
#include "md_json.h"
#include "md_log.h"
#include "md_http.h"
#include "md_time.h"
#include "md_util.h"

Go to the source code of this file.

Classes

struct  md_pkey_t
 
struct  passwd_ctx
 
struct  md_cert_t
 

Macros

#define MD_GET_NID(x)   get_nid(MD_OID_##x##_NUM, MD_OID_##x##_SNAME, MD_OID_##x##_LNAME)
 
#define MD_OID_MUST_STAPLE_NUM   "1.3.6.1.5.5.7.1.24"
 
#define MD_OID_MUST_STAPLE_SNAME   "tlsfeature"
 
#define MD_OID_MUST_STAPLE_LNAME   "TLS Feature"
 
#define MD_OID_ACME_VALIDATION_NUM   "1.3.6.1.5.5.7.1.31"
 
#define MD_OID_ACME_VALIDATION_SNAME   "pe-acmeIdentifier"
 
#define MD_OID_ACME_VALIDATION_LNAME   "ACME Identifier"
 
#define MD_OID_CT_SCTS_NUM   "1.3.6.1.4.1.11129.2.4.2"
 
#define MD_OID_CT_SCTS_SNAME   "CT-SCTs"
 
#define MD_OID_CT_SCTS_LNAME   "CT Certificate SCTs"
 

Functions

static int rand_choosenum (int l, int h)
 
static void seed_RAND (int pid)
 
apr_status_t md_crypt_init (apr_pool_t *pool)
 
static apr_status_t fwrite_buffer (void *baton, apr_file_t *f, apr_pool_t *p)
 
apr_status_t md_rand_bytes (unsigned char *buf, apr_size_t len, apr_pool_t *p)
 
static int pem_passwd (char *buf, int size, int rwflag, void *baton)
 
static apr_time_t md_asn1_time_get (const ASN1_TIME *time)
 
apr_time_t md_asn1_generalized_time_get (void *ASN1_GENERALIZEDTIME)
 
static int get_nid (const char *num, const char *sname, const char *lname)
 
md_pkeys_spec_tmd_pkeys_spec_make (apr_pool_t *p)
 
void md_pkeys_spec_add (md_pkeys_spec_t *pks, md_pkey_spec_t *spec)
 
void md_pkeys_spec_add_default (md_pkeys_spec_t *pks)
 
int md_pkeys_spec_contains_rsa (md_pkeys_spec_t *pks)
 
void md_pkeys_spec_add_rsa (md_pkeys_spec_t *pks, unsigned int bits)
 
int md_pkeys_spec_contains_ec (md_pkeys_spec_t *pks, const char *curve)
 
void md_pkeys_spec_add_ec (md_pkeys_spec_t *pks, const char *curve)
 
md_json_tmd_pkey_spec_to_json (const md_pkey_spec_t *spec, apr_pool_t *p)
 
static apr_status_t spec_to_json (void *value, md_json_t *json, apr_pool_t *p, void *baton)
 
md_json_tmd_pkeys_spec_to_json (const md_pkeys_spec_t *pks, apr_pool_t *p)
 
md_pkey_spec_tmd_pkey_spec_from_json (struct md_json_t *json, apr_pool_t *p)
 
static apr_status_t spec_from_json (void **pvalue, md_json_t *json, apr_pool_t *p, void *baton)
 
md_pkeys_spec_tmd_pkeys_spec_from_json (struct md_json_t *json, apr_pool_t *p)
 
static int pkey_spec_eq (md_pkey_spec_t *s1, md_pkey_spec_t *s2)
 
int md_pkeys_spec_eq (md_pkeys_spec_t *pks1, md_pkeys_spec_t *pks2)
 
static md_pkey_spec_tpkey_spec_clone (apr_pool_t *p, md_pkey_spec_t *spec)
 
const charmd_pkey_spec_name (const md_pkey_spec_t *spec)
 
int md_pkeys_spec_is_empty (const md_pkeys_spec_t *pks)
 
md_pkeys_spec_tmd_pkeys_spec_clone (apr_pool_t *p, const md_pkeys_spec_t *pks)
 
int md_pkeys_spec_count (const md_pkeys_spec_t *pks)
 
md_pkey_spec_tmd_pkeys_spec_get (const md_pkeys_spec_t *pks, int index)
 
static md_pkey_tmake_pkey (apr_pool_t *p)
 
static apr_status_t pkey_cleanup (void *data)
 
void md_pkey_free (md_pkey_t *pkey)
 
void * md_pkey_get_EVP_PKEY (struct md_pkey_t *pkey)
 
apr_status_t md_pkey_fload (md_pkey_t **ppkey, apr_pool_t *p, const char *key, apr_size_t key_len, const char *fname)
 
static apr_status_t pkey_to_buffer (md_data_t *buf, md_pkey_t *pkey, apr_pool_t *p, const char *pass, apr_size_t pass_len)
 
apr_status_t md_pkey_fsave (md_pkey_t *pkey, apr_pool_t *p, const char *pass_phrase, apr_size_t pass_len, const char *fname, apr_fileperms_t perms)
 
apr_status_t md_pkey_read_http (md_pkey_t **ppkey, apr_pool_t *pool, const struct md_http_response_t *res)
 
static const EVP_MDpkey_get_MD (md_pkey_t *pkey)
 
static apr_status_t gen_rsa (md_pkey_t **ppkey, apr_pool_t *p, unsigned int bits)
 
static apr_status_t check_EC_curve (int nid, apr_pool_t *p)
 
static apr_status_t gen_ec (md_pkey_t **ppkey, apr_pool_t *p, const char *curve)
 
apr_status_t md_pkey_gen (md_pkey_t **ppkey, apr_pool_t *p, md_pkey_spec_t *spec)
 
static void RSA_get0_key (const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
 
static const charbn64 (const BIGNUM *b, apr_pool_t *p)
 
const charmd_pkey_get_rsa_e64 (md_pkey_t *pkey, apr_pool_t *p)
 
const charmd_pkey_get_rsa_n64 (md_pkey_t *pkey, apr_pool_t *p)
 
apr_status_t md_crypt_sign64 (const char **psign64, md_pkey_t *pkey, apr_pool_t *p, const char *d, size_t dlen)
 
static apr_status_t sha256_digest (md_data_t **pdigest, apr_pool_t *p, const md_data_t *buf)
 
apr_status_t md_crypt_sha256_digest64 (const char **pdigest64, apr_pool_t *p, const md_data_t *d)
 
apr_status_t md_crypt_sha256_digest_hex (const char **pdigesthex, apr_pool_t *p, const md_data_t *data)
 
apr_status_t md_crypt_hmac64 (const char **pmac64, const md_data_t *hmac_key, apr_pool_t *p, const char *d, size_t dlen)
 
static apr_status_t cert_cleanup (void *data)
 
md_cert_tmd_cert_wrap (apr_pool_t *p, void *x509)
 
md_cert_tmd_cert_make (apr_pool_t *p, void *x509)
 
void * md_cert_get_X509 (const md_cert_t *cert)
 
const charmd_cert_get_serial_number (const md_cert_t *cert, apr_pool_t *p)
 
int md_certs_are_equal (const md_cert_t *a, const md_cert_t *b)
 
int md_cert_is_valid_now (const md_cert_t *cert)
 
int md_cert_has_expired (const md_cert_t *cert)
 
apr_time_t md_cert_get_not_after (const md_cert_t *cert)
 
apr_time_t md_cert_get_not_before (const md_cert_t *cert)
 
md_timeperiod_t md_cert_get_valid (const md_cert_t *cert)
 
int md_cert_covers_domain (md_cert_t *cert, const char *domain_name)
 
int md_cert_covers_md (md_cert_t *cert, const md_t *md)
 
apr_status_t md_cert_get_issuers_uri (const char **puri, const md_cert_t *cert, apr_pool_t *p)
 
apr_status_t md_cert_get_alt_names (apr_array_header_t **pnames, const md_cert_t *cert, apr_pool_t *p)
 
apr_status_t md_cert_fload (md_cert_t **pcert, apr_pool_t *p, const char *fname)
 
static apr_status_t cert_to_buffer (md_data_t *buffer, const md_cert_t *cert, apr_pool_t *p)
 
apr_status_t md_cert_fsave (md_cert_t *cert, apr_pool_t *p, const char *fname, apr_fileperms_t perms)
 
apr_status_t md_cert_to_base64url (const char **ps64, const md_cert_t *cert, apr_pool_t *p)
 
apr_status_t md_cert_to_sha256_digest (md_data_t **pdigest, const md_cert_t *cert, apr_pool_t *p)
 
apr_status_t md_cert_to_sha256_fingerprint (const char **pfinger, const md_cert_t *cert, apr_pool_t *p)
 
static int md_cert_read_pem (BIO *bf, apr_pool_t *p, md_cert_t **pcert)
 
apr_status_t md_cert_read_chain (apr_array_header_t *chain, apr_pool_t *p, const char *pem, apr_size_t pem_len)
 
apr_status_t md_cert_read_http (md_cert_t **pcert, apr_pool_t *p, const md_http_response_t *res)
 
apr_status_t md_cert_chain_read_http (struct apr_array_header_t *chain, apr_pool_t *p, const struct md_http_response_t *res)
 
md_cert_state_t md_cert_state_get (const md_cert_t *cert)
 
apr_status_t md_chain_fappend (struct apr_array_header_t *certs, apr_pool_t *p, const char *fname)
 
apr_status_t md_chain_fload (apr_array_header_t **pcerts, apr_pool_t *p, const char *fname)
 
apr_status_t md_chain_fsave (apr_array_header_t *certs, apr_pool_t *p, const char *fname, apr_fileperms_t perms)
 
static const charalt_names (apr_array_header_t *domains, apr_pool_t *p)
 
static apr_status_t add_ext (X509 *x, int nid, const char *value, apr_pool_t *p)
 
static apr_status_t sk_add_alt_names (STACK_OF(X509_EXTENSION) *exts, apr_array_header_t *domains, apr_pool_t *p)
 
int md_cert_must_staple (const md_cert_t *cert)
 
static apr_status_t add_must_staple (STACK_OF(X509_EXTENSION) *exts, const char *name, apr_pool_t *p)
 
apr_status_t md_cert_req_create (const char **pcsr_der_64, const char *name, apr_array_header_t *domains, int must_staple, md_pkey_t *pkey, apr_pool_t *p)
 
static apr_status_t mk_x509 (X509 **px, md_pkey_t *pkey, const char *cn, apr_interval_time_t valid_for, apr_pool_t *p)
 
apr_status_t md_cert_self_sign (md_cert_t **pcert, const char *cn, apr_array_header_t *domains, md_pkey_t *pkey, apr_interval_time_t valid_for, apr_pool_t *p)
 
static int get_acme_validation_nid (void)
 
apr_status_t md_cert_make_tls_alpn_01 (md_cert_t **pcert, const char *domain, const char *acme_id, md_pkey_t *pkey, apr_interval_time_t valid_for, apr_pool_t *p)
 
static int get_ct_scts_nid (void)
 
const charmd_nid_get_sname (int nid)
 
const charmd_nid_get_lname (int nid)
 
apr_status_t md_cert_get_ct_scts (apr_array_header_t *scts, apr_pool_t *p, const md_cert_t *cert)
 
apr_status_t md_cert_get_ocsp_responder_url (const char **purl, apr_pool_t *p, const md_cert_t *cert)
 
apr_status_t md_check_cert_and_pkey (struct apr_array_header_t *certs, md_pkey_t *pkey)
 

Variables

static int initialized
 
static md_pkey_spec_t PkeySpecDef = { MD_PKEY_TYPE_DEFAULT, {{ 0 }} }
 

Macro Definition Documentation

◆ MD_GET_NID

#define MD_GET_NID (   x)    get_nid(MD_OID_##x##_NUM, MD_OID_##x##_SNAME, MD_OID_##x##_LNAME)

Definition at line 276 of file md_crypt.c.

◆ MD_OID_ACME_VALIDATION_LNAME

#define MD_OID_ACME_VALIDATION_LNAME   "ACME Identifier"

Definition at line 1988 of file md_crypt.c.

◆ MD_OID_ACME_VALIDATION_NUM

#define MD_OID_ACME_VALIDATION_NUM   "1.3.6.1.5.5.7.1.31"

Definition at line 1986 of file md_crypt.c.

◆ MD_OID_ACME_VALIDATION_SNAME

#define MD_OID_ACME_VALIDATION_SNAME   "pe-acmeIdentifier"

Definition at line 1987 of file md_crypt.c.

◆ MD_OID_CT_SCTS_LNAME

#define MD_OID_CT_SCTS_LNAME   "CT Certificate SCTs"

Definition at line 2042 of file md_crypt.c.

◆ MD_OID_CT_SCTS_NUM

#define MD_OID_CT_SCTS_NUM   "1.3.6.1.4.1.11129.2.4.2"

Definition at line 2040 of file md_crypt.c.

◆ MD_OID_CT_SCTS_SNAME

#define MD_OID_CT_SCTS_SNAME   "CT-SCTs"

Definition at line 2041 of file md_crypt.c.

◆ MD_OID_MUST_STAPLE_LNAME

#define MD_OID_MUST_STAPLE_LNAME   "TLS Feature"

Definition at line 1749 of file md_crypt.c.

◆ MD_OID_MUST_STAPLE_NUM

#define MD_OID_MUST_STAPLE_NUM   "1.3.6.1.5.5.7.1.24"

Definition at line 1747 of file md_crypt.c.

◆ MD_OID_MUST_STAPLE_SNAME

#define MD_OID_MUST_STAPLE_SNAME   "tlsfeature"

Definition at line 1748 of file md_crypt.c.

Function Documentation

◆ add_ext()

static apr_status_t add_ext ( X509 x,
int  nid,
const char value,
apr_pool_t p 
)
static

Definition at line 1705 of file md_crypt.c.

◆ add_must_staple()

static apr_status_t add_must_staple ( STACK_OF(X509_EXTENSION) *  exts,
const char name,
apr_pool_t p 
)
static

Definition at line 1758 of file md_crypt.c.

◆ alt_names()

static const char * alt_names ( apr_array_header_t domains,
apr_pool_t p 
)
static

Definition at line 1692 of file md_crypt.c.

◆ bn64()

static const char * bn64 ( const BIGNUM b,
apr_pool_t p 
)
static

Definition at line 965 of file md_crypt.c.

◆ cert_cleanup()

static apr_status_t cert_cleanup ( void *  data)
static

Definition at line 1150 of file md_crypt.c.

◆ cert_to_buffer()

static apr_status_t cert_to_buffer ( md_data_t buffer,
const md_cert_t cert,
apr_pool_t p 
)
static

Definition at line 1377 of file md_crypt.c.

◆ check_EC_curve()

static apr_status_t check_EC_curve ( int  nid,
apr_pool_t p 
)
static

Definition at line 796 of file md_crypt.c.

◆ fwrite_buffer()

static apr_status_t fwrite_buffer ( void *  baton,
apr_file_t f,
apr_pool_t p 
)
static

Definition at line 153 of file md_crypt.c.

◆ gen_ec()

static apr_status_t gen_ec ( md_pkey_t **  ppkey,
apr_pool_t p,
const char curve 
)
static

Definition at line 820 of file md_crypt.c.

◆ gen_rsa()

static apr_status_t gen_rsa ( md_pkey_t **  ppkey,
apr_pool_t p,
unsigned int  bits 
)
static

Definition at line 771 of file md_crypt.c.

◆ get_acme_validation_nid()

static int get_acme_validation_nid ( void  )
static

Definition at line 1990 of file md_crypt.c.

◆ get_ct_scts_nid()

static int get_ct_scts_nid ( void  )
static

Definition at line 2045 of file md_crypt.c.

◆ get_nid()

static int get_nid ( const char num,
const char sname,
const char lname 
)
static

Definition at line 264 of file md_crypt.c.

◆ make_pkey()

static md_pkey_t * make_pkey ( apr_pool_t p)
static

Definition at line 573 of file md_crypt.c.

◆ md_asn1_generalized_time_get()

apr_time_t md_asn1_generalized_time_get ( void *  ASN1_GENERALIZEDTIME)

Definition at line 256 of file md_crypt.c.

◆ md_asn1_time_get()

static apr_time_t md_asn1_time_get ( const ASN1_TIME time)
static

Definition at line 204 of file md_crypt.c.

◆ md_cert_chain_read_http()

apr_status_t md_cert_chain_read_http ( struct apr_array_header_t chain,
apr_pool_t pool,
const struct md_http_response_t res 
)

Read one or even a chain of certificates from a http response. Will return APR_ENOENT if content-type is not recognized (currently supports only "application/pem-certificate-chain" and "application/pkix-cert").

Parameters
chainmust be non-NULL, retrieved certificates will be added.

Definition at line 1540 of file md_crypt.c.

◆ md_cert_covers_domain()

int md_cert_covers_domain ( md_cert_t cert,
const char domain_name 
)

Definition at line 1230 of file md_crypt.c.

◆ md_cert_covers_md()

int md_cert_covers_md ( md_cert_t cert,
const md_t md 
)

Definition at line 1241 of file md_crypt.c.

◆ md_cert_fload()

apr_status_t md_cert_fload ( md_cert_t **  pcert,
apr_pool_t p,
const char fname 
)

Definition at line 1353 of file md_crypt.c.

◆ md_cert_fsave()

apr_status_t md_cert_fsave ( md_cert_t cert,
apr_pool_t p,
const char fname,
apr_fileperms_t  perms 
)

Definition at line 1403 of file md_crypt.c.

◆ md_cert_get_alt_names()

apr_status_t md_cert_get_alt_names ( apr_array_header_t **  pnames,
const md_cert_t cert,
apr_pool_t p 
)

Definition at line 1295 of file md_crypt.c.

◆ md_cert_get_ct_scts()

apr_status_t md_cert_get_ct_scts ( apr_array_header_t scts,
apr_pool_t p,
const md_cert_t cert 
)

Definition at line 2066 of file md_crypt.c.

◆ md_cert_get_issuers_uri()

apr_status_t md_cert_get_issuers_uri ( const char **  puri,
const md_cert_t cert,
apr_pool_t p 
)

Definition at line 1268 of file md_crypt.c.

◆ md_cert_get_not_after()

apr_time_t md_cert_get_not_after ( const md_cert_t cert)

Definition at line 1212 of file md_crypt.c.

◆ md_cert_get_not_before()

apr_time_t md_cert_get_not_before ( const md_cert_t cert)

Definition at line 1217 of file md_crypt.c.

◆ md_cert_get_ocsp_responder_url()

apr_status_t md_cert_get_ocsp_responder_url ( const char **  purl,
apr_pool_t p,
const md_cert_t cert 
)

Definition at line 2111 of file md_crypt.c.

◆ md_cert_get_serial_number()

const char * md_cert_get_serial_number ( const md_cert_t cert,
apr_pool_t p 
)

Definition at line 1180 of file md_crypt.c.

◆ md_cert_get_valid()

md_timeperiod_t md_cert_get_valid ( const md_cert_t cert)

Definition at line 1222 of file md_crypt.c.

◆ md_cert_get_X509()

void * md_cert_get_X509 ( const md_cert_t cert)

Definition at line 1175 of file md_crypt.c.

◆ md_cert_has_expired()

int md_cert_has_expired ( const md_cert_t cert)

Definition at line 1207 of file md_crypt.c.

◆ md_cert_is_valid_now()

int md_cert_is_valid_now ( const md_cert_t cert)

Definition at line 1201 of file md_crypt.c.

◆ md_cert_make()

md_cert_t * md_cert_make ( apr_pool_t p,
void *  x509 
)

Create a holder of the certificate that will free its memory when the pool is destroyed.

Definition at line 1168 of file md_crypt.c.

◆ md_cert_make_tls_alpn_01()

apr_status_t md_cert_make_tls_alpn_01 ( md_cert_t **  pcert,
const char domain,
const char acme_id,
md_pkey_t pkey,
apr_interval_time_t  valid_for,
apr_pool_t p 
)

Create a certificate for answering "tls-alpn-01" ACME challenges (see https://tools.ietf.org/html/draft-ietf-acme-tls-alpn-01).

Definition at line 2000 of file md_crypt.c.

◆ md_cert_must_staple()

int md_cert_must_staple ( const md_cert_t cert)

Definition at line 1751 of file md_crypt.c.

◆ md_cert_read_chain()

apr_status_t md_cert_read_chain ( apr_array_header_t chain,
apr_pool_t p,
const char pem,
apr_size_t  pem_len 
)

Read at least one certificate from the given PEM data.

Definition at line 1472 of file md_crypt.c.

◆ md_cert_read_http()

apr_status_t md_cert_read_http ( md_cert_t **  pcert,
apr_pool_t p,
const md_http_response_t res 
)

Definition at line 1498 of file md_crypt.c.

◆ md_cert_read_pem()

static int md_cert_read_pem ( BIO bf,
apr_pool_t p,
md_cert_t **  pcert 
)
static

Definition at line 1456 of file md_crypt.c.

◆ md_cert_req_create()

apr_status_t md_cert_req_create ( const char **  pcsr_der_64,
const char name,
apr_array_header_t domains,
int  must_staple,
md_pkey_t pkey,
apr_pool_t p 
)

Definition at line 1779 of file md_crypt.c.

◆ md_cert_self_sign()

apr_status_t md_cert_self_sign ( md_cert_t **  pcert,
const char cn,
struct apr_array_header_t domains,
md_pkey_t pkey,
apr_interval_time_t  valid_for,
apr_pool_t p 
)

Create a self-signed cerftificate with the given cn, key and list of alternate domain names.

Definition at line 1942 of file md_crypt.c.

◆ md_cert_state_get()

md_cert_state_t md_cert_state_get ( const md_cert_t cert)

Definition at line 1593 of file md_crypt.c.

◆ md_cert_to_base64url()

apr_status_t md_cert_to_base64url ( const char **  ps64,
const md_cert_t cert,
apr_pool_t p 
)

Definition at line 1416 of file md_crypt.c.

◆ md_cert_to_sha256_digest()

apr_status_t md_cert_to_sha256_digest ( md_data_t **  pdigest,
const md_cert_t cert,
apr_pool_t p 
)

Definition at line 1430 of file md_crypt.c.

◆ md_cert_to_sha256_fingerprint()

apr_status_t md_cert_to_sha256_fingerprint ( const char **  pfinger,
const md_cert_t cert,
apr_pool_t p 
)

Definition at line 1443 of file md_crypt.c.

◆ md_cert_wrap()

md_cert_t * md_cert_wrap ( apr_pool_t p,
void *  x509 
)

Wrap a x509 certificate into our own structure, without taking ownership of its memory. The caller remains responsible.

Definition at line 1160 of file md_crypt.c.

◆ md_certs_are_equal()

int md_certs_are_equal ( const md_cert_t a,
const md_cert_t b 
)

Return != 0 iff the hash values of the certificates are equal.

Definition at line 1196 of file md_crypt.c.

◆ md_chain_fappend()

apr_status_t md_chain_fappend ( struct apr_array_header_t certs,
apr_pool_t p,
const char fname 
)

< Size of the file

Definition at line 1601 of file md_crypt.c.

◆ md_chain_fload()

apr_status_t md_chain_fload ( apr_array_header_t **  pcerts,
apr_pool_t p,
const char fname 
)

Definition at line 1645 of file md_crypt.c.

◆ md_chain_fsave()

apr_status_t md_chain_fsave ( apr_array_header_t certs,
apr_pool_t p,
const char fname,
apr_fileperms_t  perms 
)

Definition at line 1656 of file md_crypt.c.

◆ md_check_cert_and_pkey()

apr_status_t md_check_cert_and_pkey ( struct apr_array_header_t certs,
md_pkey_t pkey 
)

Definition at line 2131 of file md_crypt.c.

◆ md_crypt_hmac64()

apr_status_t md_crypt_hmac64 ( const char **  pmac64,
const md_data_t hmac_key,
apr_pool_t p,
const char d,
size_t  dlen 
)

Definition at line 1116 of file md_crypt.c.

◆ md_crypt_init()

apr_status_t md_crypt_init ( apr_pool_t pool)

Definition at line 133 of file md_crypt.c.

◆ md_crypt_sha256_digest64()

apr_status_t md_crypt_sha256_digest64 ( const char **  pdigest64,
apr_pool_t p,
const md_data_t d 
)

Definition at line 1088 of file md_crypt.c.

◆ md_crypt_sha256_digest_hex()

apr_status_t md_crypt_sha256_digest_hex ( const char **  pdigesthex,
apr_pool_t p,
const md_data_t data 
)

Definition at line 1103 of file md_crypt.c.

◆ md_crypt_sign64()

apr_status_t md_crypt_sign64 ( const char **  psign64,
md_pkey_t pkey,
apr_pool_t p,
const char d,
size_t  dlen 
)

Definition at line 1019 of file md_crypt.c.

◆ md_nid_get_lname()

const char * md_nid_get_lname ( int  nid)

Definition at line 2061 of file md_crypt.c.

◆ md_nid_get_sname()

const char * md_nid_get_sname ( int  nid)

Definition at line 2056 of file md_crypt.c.

◆ md_pkey_fload()

apr_status_t md_pkey_fload ( md_pkey_t **  ppkey,
apr_pool_t p,
const char key,
apr_size_t  key_len,
const char fname 
)

Definition at line 600 of file md_crypt.c.

◆ md_pkey_free()

void md_pkey_free ( md_pkey_t pkey)

Definition at line 590 of file md_crypt.c.

◆ md_pkey_fsave()

apr_status_t md_pkey_fsave ( md_pkey_t pkey,
apr_pool_t p,
const char pass_phrase,
apr_size_t  pass_len,
const char fname,
apr_fileperms_t  perms 
)

Definition at line 691 of file md_crypt.c.

◆ md_pkey_gen()

apr_status_t md_pkey_gen ( md_pkey_t **  ppkey,
apr_pool_t p,
md_pkey_spec_t spec 
)

Definition at line 933 of file md_crypt.c.

◆ md_pkey_get_EVP_PKEY()

void * md_pkey_get_EVP_PKEY ( struct md_pkey_t pkey)

Definition at line 595 of file md_crypt.c.

◆ md_pkey_get_rsa_e64()

const char * md_pkey_get_rsa_e64 ( md_pkey_t pkey,
apr_pool_t p 
)

Definition at line 979 of file md_crypt.c.

◆ md_pkey_get_rsa_n64()

const char * md_pkey_get_rsa_n64 ( md_pkey_t pkey,
apr_pool_t p 
)

Definition at line 999 of file md_crypt.c.

◆ md_pkey_read_http()

apr_status_t md_pkey_read_http ( md_pkey_t **  ppkey,
apr_pool_t pool,
const struct md_http_response_t res 
)

Read a private key from a http response.

Definition at line 706 of file md_crypt.c.

◆ md_pkey_spec_from_json()

md_pkey_spec_t * md_pkey_spec_from_json ( struct md_json_t json,
apr_pool_t p 
)

Definition at line 397 of file md_crypt.c.

◆ md_pkey_spec_name()

const char * md_pkey_spec_name ( const md_pkey_spec_t spec)

Definition at line 520 of file md_crypt.c.

◆ md_pkey_spec_to_json()

md_json_t * md_pkey_spec_to_json ( const md_pkey_spec_t spec,
apr_pool_t p 
)

Definition at line 348 of file md_crypt.c.

◆ md_pkeys_spec_add()

void md_pkeys_spec_add ( md_pkeys_spec_t pks,
md_pkey_spec_t spec 
)

Definition at line 291 of file md_crypt.c.

◆ md_pkeys_spec_add_default()

void md_pkeys_spec_add_default ( md_pkeys_spec_t pks)

Definition at line 296 of file md_crypt.c.

◆ md_pkeys_spec_add_ec()

void md_pkeys_spec_add_ec ( md_pkeys_spec_t pks,
const char curve 
)

Definition at line 338 of file md_crypt.c.

◆ md_pkeys_spec_add_rsa()

void md_pkeys_spec_add_rsa ( md_pkeys_spec_t pks,
unsigned int  bits 
)

Definition at line 316 of file md_crypt.c.

◆ md_pkeys_spec_clone()

md_pkeys_spec_t * md_pkeys_spec_clone ( apr_pool_t p,
const md_pkeys_spec_t pks 
)

Definition at line 538 of file md_crypt.c.

◆ md_pkeys_spec_contains_ec()

int md_pkeys_spec_contains_ec ( md_pkeys_spec_t pks,
const char curve 
)

Definition at line 326 of file md_crypt.c.

◆ md_pkeys_spec_contains_rsa()

int md_pkeys_spec_contains_rsa ( md_pkeys_spec_t pks)

Definition at line 305 of file md_crypt.c.

◆ md_pkeys_spec_count()

int md_pkeys_spec_count ( const md_pkeys_spec_t pks)

Definition at line 555 of file md_crypt.c.

◆ md_pkeys_spec_eq()

int md_pkeys_spec_eq ( md_pkeys_spec_t pks1,
md_pkeys_spec_t pks2 
)

Definition at line 482 of file md_crypt.c.

◆ md_pkeys_spec_from_json()

md_pkeys_spec_t * md_pkeys_spec_from_json ( struct md_json_t json,
apr_pool_t p 
)

Definition at line 439 of file md_crypt.c.

◆ md_pkeys_spec_get()

md_pkey_spec_t * md_pkeys_spec_get ( const md_pkeys_spec_t pks,
int  index 
)

Definition at line 562 of file md_crypt.c.

◆ md_pkeys_spec_is_empty()

int md_pkeys_spec_is_empty ( const md_pkeys_spec_t pks)

Definition at line 533 of file md_crypt.c.

◆ md_pkeys_spec_make()

md_pkeys_spec_t * md_pkeys_spec_make ( apr_pool_t p)

Definition at line 281 of file md_crypt.c.

◆ md_pkeys_spec_to_json()

md_json_t * md_pkeys_spec_to_json ( const md_pkeys_spec_t pks,
apr_pool_t p 
)

Definition at line 385 of file md_crypt.c.

◆ md_rand_bytes()

apr_status_t md_rand_bytes ( unsigned char buf,
apr_size_t  len,
apr_pool_t p 
)

Definition at line 162 of file md_crypt.c.

◆ mk_x509()

static apr_status_t mk_x509 ( X509 **  px,
md_pkey_t pkey,
const char cn,
apr_interval_time_t  valid_for,
apr_pool_t p 
)
static

Definition at line 1875 of file md_crypt.c.

◆ pem_passwd()

static int pem_passwd ( char buf,
int  size,
int  rwflag,
void *  baton 
)
static

Definition at line 180 of file md_crypt.c.

◆ pkey_cleanup()

static apr_status_t pkey_cleanup ( void *  data)
static

Definition at line 580 of file md_crypt.c.

◆ pkey_get_MD()

static const EVP_MD * pkey_get_MD ( md_pkey_t pkey)
static

Definition at line 755 of file md_crypt.c.

◆ pkey_spec_clone()

static md_pkey_spec_t * pkey_spec_clone ( apr_pool_t p,
md_pkey_spec_t spec 
)
static

Definition at line 501 of file md_crypt.c.

◆ pkey_spec_eq()

static int pkey_spec_eq ( md_pkey_spec_t s1,
md_pkey_spec_t s2 
)
static

Definition at line 455 of file md_crypt.c.

◆ pkey_to_buffer()

static apr_status_t pkey_to_buffer ( md_data_t buf,
md_pkey_t pkey,
apr_pool_t p,
const char pass,
apr_size_t  pass_len 
)
static

Definition at line 634 of file md_crypt.c.

◆ rand_choosenum()

static int rand_choosenum ( int  l,
int  h 
)
static

Definition at line 88 of file md_crypt.c.

◆ RSA_get0_key()

static void RSA_get0_key ( const RSA r,
const BIGNUM **  n,
const BIGNUM **  e,
const BIGNUM **  d 
)
static

Definition at line 952 of file md_crypt.c.

◆ seed_RAND()

static void seed_RAND ( int  pid)
static

Definition at line 101 of file md_crypt.c.

◆ sha256_digest()

static apr_status_t sha256_digest ( md_data_t **  pdigest,
apr_pool_t p,
const md_data_t buf 
)
static

Definition at line 1060 of file md_crypt.c.

◆ sk_add_alt_names()

static apr_status_t sk_add_alt_names ( STACK_OF(X509_EXTENSION) *  exts,
apr_array_header_t domains,
apr_pool_t p 
)
static

Definition at line 1732 of file md_crypt.c.

◆ spec_from_json()

static apr_status_t spec_from_json ( void **  pvalue,
md_json_t json,
apr_pool_t p,
void *  baton 
)
static

Definition at line 432 of file md_crypt.c.

◆ spec_to_json()

static apr_status_t spec_to_json ( void *  value,
md_json_t json,
apr_pool_t p,
void *  baton 
)
static

Definition at line 376 of file md_crypt.c.

Variable Documentation

◆ initialized

int initialized
static

Definition at line 68 of file md_crypt.c.

◆ PkeySpecDef

md_pkey_spec_t PkeySpecDef = { MD_PKEY_TYPE_DEFAULT, {{ 0 }} }
static

Definition at line 560 of file md_crypt.c.