Botan 3.6.1
Crypto and TLS for C&
|
#include <botan/ffi.h>
#include <botan/internal/ffi_pkey.h>
#include <botan/internal/ffi_util.h>
#include <memory>
Go to the source code of this file.
Functions | |
int | botan_x509_cert_allowed_usage (botan_x509_cert_t cert, unsigned int key_usage) |
int | botan_x509_cert_destroy (botan_x509_cert_t cert) |
int | botan_x509_cert_dup (botan_x509_cert_t *cert_obj, botan_x509_cert_t cert) |
int | botan_x509_cert_get_authority_key_id (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_fingerprint (botan_x509_cert_t cert, const char *hash, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_issuer_dn (botan_x509_cert_t cert, const char *key, size_t index, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_public_key (botan_x509_cert_t cert, botan_pubkey_t *key) |
int | botan_x509_cert_get_public_key_bits (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_serial_number (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_subject_dn (botan_x509_cert_t cert, const char *key, size_t index, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_subject_key_id (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_time_expires (botan_x509_cert_t cert, char out[], size_t *out_len) |
int | botan_x509_cert_get_time_starts (botan_x509_cert_t cert, char out[], size_t *out_len) |
int | botan_x509_cert_hostname_match (botan_x509_cert_t cert, const char *hostname) |
int | botan_x509_cert_load (botan_x509_cert_t *cert_obj, const uint8_t cert_bits[], size_t cert_bits_len) |
int | botan_x509_cert_load_file (botan_x509_cert_t *cert_obj, const char *cert_path) |
int | botan_x509_cert_not_after (botan_x509_cert_t cert, uint64_t *time_since_epoch) |
int | botan_x509_cert_not_before (botan_x509_cert_t cert, uint64_t *time_since_epoch) |
int | botan_x509_cert_to_string (botan_x509_cert_t cert, char out[], size_t *out_len) |
const char * | botan_x509_cert_validation_status (int code) |
int | botan_x509_cert_verify (int *result_code, botan_x509_cert_t cert, const botan_x509_cert_t *intermediates, size_t intermediates_len, const botan_x509_cert_t *trusted, size_t trusted_len, const char *trusted_path, size_t required_strength, const char *hostname_cstr, uint64_t reference_time) |
int | botan_x509_cert_verify_with_crl (int *result_code, botan_x509_cert_t cert, const botan_x509_cert_t *intermediates, size_t intermediates_len, const botan_x509_cert_t *trusted, size_t trusted_len, const botan_x509_crl_t *crls, size_t crls_len, const char *trusted_path, size_t required_strength, const char *hostname_cstr, uint64_t reference_time) |
int | botan_x509_cert_view_as_string (botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_str_fn view) |
int | botan_x509_cert_view_public_key_bits (botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_bin_fn view) |
int | botan_x509_crl_destroy (botan_x509_crl_t crl) |
int | botan_x509_crl_load (botan_x509_crl_t *crl_obj, const uint8_t crl_bits[], size_t crl_bits_len) |
int | botan_x509_crl_load_file (botan_x509_crl_t *crl_obj, const char *crl_path) |
int | botan_x509_is_revoked (botan_x509_crl_t crl, botan_x509_cert_t cert) |
int botan_x509_cert_allowed_usage | ( | botan_x509_cert_t | cert, |
unsigned int | key_usage ) |
Definition at line 139 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
int botan_x509_cert_destroy | ( | botan_x509_cert_t | cert | ) |
Definition at line 153 of file ffi_cert.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_x509_cert_dup | ( | botan_x509_cert_t * | cert_obj, |
botan_x509_cert_t | cert ) |
Definition at line 48 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::safe_get().
int botan_x509_cert_get_authority_key_id | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 218 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_vec_output().
int botan_x509_cert_get_fingerprint | ( | botan_x509_cert_t | cert, |
const char * | hash, | ||
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 209 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
int botan_x509_cert_get_issuer_dn | ( | botan_x509_cert_t | cert, |
const char * | key, | ||
size_t | index, | ||
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 104 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
int botan_x509_cert_get_public_key | ( | botan_x509_cert_t | cert, |
botan_pubkey_t * | key ) |
Definition at line 85 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::safe_get().
int botan_x509_cert_get_public_key_bits | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 236 of file ffi_cert.cpp.
References botan_x509_cert_view_public_key_bits(), and Botan_FFI::copy_view_bin().
int botan_x509_cert_get_serial_number | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 200 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_vec_output().
int botan_x509_cert_get_subject_dn | ( | botan_x509_cert_t | cert, |
const char * | key, | ||
size_t | index, | ||
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 115 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
int botan_x509_cert_get_subject_key_id | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len ) |
Definition at line 227 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_vec_output().
int botan_x509_cert_get_time_expires | ( | botan_x509_cert_t | cert, |
char | out[], | ||
size_t * | out_len ) |
Definition at line 172 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
int botan_x509_cert_get_time_starts | ( | botan_x509_cert_t | cert, |
char | out[], | ||
size_t * | out_len ) |
Definition at line 162 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
int botan_x509_cert_hostname_match | ( | botan_x509_cert_t | cert, |
const char * | hostname ) |
Check if the certificate matches the specified hostname via alternative name or CN match. RFC 5280 wildcards also supported.
Definition at line 250 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
int botan_x509_cert_load | ( | botan_x509_cert_t * | cert_obj, |
const uint8_t | cert_bits[], | ||
size_t | cert_bits_len ) |
Definition at line 67 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, and Botan_FFI::ffi_guard_thunk().
int botan_x509_cert_load_file | ( | botan_x509_cert_t * | cert_obj, |
const char * | cert_path ) |
Definition at line 30 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, and Botan_FFI::ffi_guard_thunk().
int botan_x509_cert_not_after | ( | botan_x509_cert_t | cert, |
uint64_t * | time_since_epoch ) |
Definition at line 191 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
int botan_x509_cert_not_before | ( | botan_x509_cert_t | cert, |
uint64_t * | time_since_epoch ) |
Definition at line 182 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
int botan_x509_cert_to_string | ( | botan_x509_cert_t | cert, |
char | out[], | ||
size_t * | out_len ) |
Definition at line 126 of file ffi_cert.cpp.
References botan_x509_cert_view_as_string(), and Botan_FFI::copy_view_str().
const char * botan_x509_cert_validation_status | ( | int | code | ) |
Returns a pointer to a static character string explaining the status code, or else NULL if unknown.
Definition at line 330 of file ffi_cert.cpp.
References Botan::to_string().
int botan_x509_cert_verify | ( | int * | validation_result, |
botan_x509_cert_t | cert, | ||
const botan_x509_cert_t * | intermediates, | ||
size_t | intermediates_len, | ||
const botan_x509_cert_t * | trusted, | ||
size_t | trusted_len, | ||
const char * | trusted_path, | ||
size_t | required_strength, | ||
const char * | hostname, | ||
uint64_t | reference_time ) |
Returns 0 if the validation was successful, 1 if validation failed, and negative on error. A status code with details is written to *validation_result
Intermediates or trusted lists can be null Trusted path can be null
Definition at line 263 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::safe_get(), Botan::UNSPECIFIED, and Botan::x509_path_validate().
int botan_x509_cert_verify_with_crl | ( | int * | validation_result, |
botan_x509_cert_t | cert, | ||
const botan_x509_cert_t * | intermediates, | ||
size_t | intermediates_len, | ||
const botan_x509_cert_t * | trusted, | ||
size_t | trusted_len, | ||
const botan_x509_crl_t * | crls, | ||
size_t | crls_len, | ||
const char * | trusted_path, | ||
size_t | required_strength, | ||
const char * | hostname, | ||
uint64_t | reference_time ) |
Different flavor of botan_x509_cert_verify
, supports revocation lists. CRLs are passed as an array, same as intermediates and trusted CAs
Definition at line 404 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::safe_get(), Botan::UNSPECIFIED, and Botan::x509_path_validate().
int botan_x509_cert_view_as_string | ( | botan_x509_cert_t | cert, |
botan_view_ctx | ctx, | ||
botan_view_str_fn | view ) |
Definition at line 130 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::invoke_view_callback().
Referenced by botan_x509_cert_to_string().
int botan_x509_cert_view_public_key_bits | ( | botan_x509_cert_t | cert, |
botan_view_ctx | ctx, | ||
botan_view_bin_fn | view ) |
Definition at line 240 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::invoke_view_callback().
Referenced by botan_x509_cert_get_public_key_bits().
int botan_x509_crl_destroy | ( | botan_x509_crl_t | crl | ) |
Definition at line 385 of file ffi_cert.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_x509_crl_load | ( | botan_x509_crl_t * | crl_obj, |
const uint8_t | crl_bits[], | ||
size_t | crl_bits_len ) |
Definition at line 367 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, and Botan_FFI::ffi_guard_thunk().
int botan_x509_crl_load_file | ( | botan_x509_crl_t * | crl_obj, |
const char * | crl_path ) |
Definition at line 349 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, and Botan_FFI::ffi_guard_thunk().
int botan_x509_is_revoked | ( | botan_x509_crl_t | crl, |
botan_x509_cert_t | cert ) |
Given a CRL and a certificate, check if the certificate is revoked on that particular CRL
Definition at line 394 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::safe_get().