18#ifndef _CRYPTO_UTILS_H
19#define _CRYPTO_UTILS_H
21#include "openssl/x509.h"
22#include "openssl/x509_vfy.h"
38 const char *function,
const char *fmt, ...)
39 __attribute__((format(printf, 5, 6)));
52 const
char *short_name, const
char *long_name);
74 const
char *short_name);
140 unsigned char **raw_key);
195#define crypto_free_cert_store(store) ao2_cleanup(store)
267#define crypto_lock_cert_store(store) ao2_lock(store)
277#define crypto_unlock_cert_store(store) ao2_unlock(store)
Asterisk main include file. File version handling, generic pbx functions.
X509 * crypto_load_cert_from_memory(const char *buffer, size_t size)
Load an X509 Cert from a NULL terminated buffer.
int crypto_load_crl_store(struct crypto_cert_store *store, const char *file, const char *path)
Load an X509 Store with certificate revocation lists.
int crypto_is_cert_trusted(struct crypto_cert_store *store, X509 *cert, const char **err_msg)
Check if the cert is trusted.
void crypto_log_openssl(int level, char *file, int line, const char *function, const char *fmt,...)
Print a log message with any OpenSSL errors appended.
int crypto_extract_raw_pubkey(EVP_PKEY *key, unsigned char **buffer)
Extract raw public key from EVP_PKEY.
time_t crypto_asn_time_as_time_t(ASN1_TIME *at)
Return a time_t for an ASN1_TIME.
X509_CRL * crypto_load_crl_from_file(const char *filename)
Load an X509 CRL from a PEM file.
EVP_PKEY * crypto_load_privkey_from_file(const char *filename)
Load a private key from a file.
int crypto_register_x509_extension(const char *oid, const char *short_name, const char *long_name)
Register a certificate extension to openssl.
int crypto_load_untrusted_cert_store(struct crypto_cert_store *store, const char *file, const char *path)
Load an X509 Store with untrusted certificates.
int crypto_extract_raw_privkey(EVP_PKEY *key, unsigned char **buffer)
Extract raw private key from EVP_PKEY.
int crypto_get_raw_pubkey_from_cert(X509 *cert, unsigned char **raw_key)
Retrieve RAW public key from cert.
int crypto_load(void)
Initialize the crypto utils.
char * crypto_get_cert_subject(X509 *cert, const char *short_name)
Returns the Subject (or component of Subject) from a certificate.
int crypto_is_cert_time_valid(X509 *cert, time_t reftime)
Check if the reftime is within the cert's valid dates.
struct crypto_cert_store * crypto_create_cert_store(void)
Create an empty X509 store.
int crypto_has_private_key_from_memory(const char *buffer, size_t size)
Check if the supplied buffer has a private key.
int crypto_unload(void)
Clean up the crypto utils.
X509 * crypto_load_cert_from_file(const char *filename)
Load an X509 Cert from a file.
EVP_PKEY * crypto_load_private_key_from_memory(const char *buffer, size_t size)
Load a private key from memory.
int crypto_show_cli_store(struct crypto_cert_store *store, int fd)
Dump a cert store to the asterisk CLI.
ASN1_OCTET_STRING * crypto_get_cert_extension_data(X509 *cert, int nid, const char *short_name)
Return the data from a specific extension in a cert.
int crypto_load_cert_store(struct crypto_cert_store *store, const char *file, const char *path)
Load an X509 Store with either certificates or CRLs.
Support for logging to various files, console and syslog Configuration in file logger....
ao2 object wrapper for X509_STORE that provides locking and refcounting
STACK_OF(X509) *untrusted_stack
STACK_OF(X509_CRL) *crl_stack