|
Botan 3.13.0
Crypto and TLS for C&
|
#include <botan/ffi.h>#include <botan/assert.h>#include <botan/internal/ffi_cert.h>#include <botan/internal/ffi_pkey.h>#include <botan/internal/ffi_rng.h>#include <botan/internal/ffi_util.h>#include <memory>Go to the source code of this file.
| int botan_x509_cert_allowed_extended_usage_oid | ( | botan_x509_cert_t | cert, |
| botan_asn1_oid_t | oid ) |
Check if the certificate allows the specified extended usage OID. See RFC 5280 Section 4.2.1.12 for OIDs to query for this. If no extended key usage extension is found in the certificate, this always returns "not success".
This is similar to botan_x509_cert_allowed_extended_usage_str but takes an OID object instead of a string describing the OID.
Definition at line 574 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::safe_get().
| int botan_x509_cert_allowed_extended_usage_str | ( | botan_x509_cert_t | cert, |
| const char * | oid ) |
Check if the certificate allows the specified extended usage OID. See RFC 5280 Section 4.2.1.12 for OIDs to query for this. If no extended key usage extension is found in the certificate, this always returns "not success".
Typical OIDs to check for:
The oid parameter can be either a canonical OID string or identifiers as indicated in the examples above.
Definition at line 559 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_allowed_usage | ( | botan_x509_cert_t | cert, |
| unsigned int | key_usage ) |
Check if the certificate allows the specified key usage. If no key usage extension is found in the certificate, this always returns success.
| cert | the certificate to inspect |
| key_usage | one or more values from botan_x509_cert_key_constraints, ORed together |
Definition at line 544 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 | ) |
Frees all resources of the certificate object
| cert | the certificate to destroy |
Definition at line 583 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 * | new_cert, |
| botan_x509_cert_t | cert ) |
Create a new handle referring to the same certificate
| new_cert | the new object will be placed here |
| cert | the certificate to duplicate |
Definition at line 193 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get().
| int botan_x509_cert_excluded_name_constraints | ( | botan_x509_cert_t | cert, |
| size_t | index, | ||
| botan_x509_general_name_t * | constraint ) |
Extracts "excluded" name constraints from a given cert one-by-one. Returns BOTAN_FFI_ERROR_OUT_OF_RANGE if the given index is larger than the available number of "excluded" name constraints.
Definition at line 823 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan::NameConstraints::excluded(), Botan_FFI::ffi_new_object(), and Botan::X509_Certificate::name_constraints().
| int botan_x509_cert_excluded_name_constraints_count | ( | botan_x509_cert_t | cert, |
| size_t * | count ) |
Count the "excluded" name constraints of a given cert.
| cert | the certificate to inspect |
| count | set to the number of available entries |
Definition at line 845 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_get_authority_key_id | ( | botan_x509_cert_t | cert, |
| uint8_t | out[], | ||
| size_t * | out_len ) |
Get the key identifier from the authority key identifier extension
| cert | the certificate to inspect |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 677 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 ) |
Compute the fingerprint of the certificate, formatted as a hex string with colons between the bytes
| cert | the certificate to inspect |
| Hashes | the name of the hash to use, eg "SHA-256" |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
TODO(Botan4) this should use char for the out param
Definition at line 661 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, 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 ) |
Enumerates the names of the given key in the issuer DN. If index is out of bounds, BOTAN_FFI_ERROR_BAD_PARAMETER is returned.
TODO(Botan4) use BOTAN_FFI_ERROR_OUT_OF_RANGE instead of BAD_PARAMETER TODO(Botan4) this should use char for the out param
Definition at line 457 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
| int botan_x509_cert_get_issuer_dn_count | ( | botan_x509_cert_t | cert, |
| const char * | key, | ||
| size_t * | count ) |
Count the names of the given key present in the issuer DN.
| cert | the certificate to inspect |
| key | the DN component to count, eg "Name" |
| count | set to the number of available entries |
Definition at line 478 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_get_path_length_constraint | ( | botan_x509_cert_t | cert, |
| size_t * | path_limit ) |
Retrieves the path length constraint from the certificate. If no such constraint is present, BOTAN_FFI_ERROR_NO_VALUE is returned.
Definition at line 419 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_get_public_key | ( | botan_x509_cert_t | cert, |
| botan_pubkey_t * | key ) |
Get the public key of the certificate
| cert | the certificate to inspect |
| key | the new object will be placed here |
Definition at line 439 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), 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 ) |
Get the DER encoded SubjectPublicKeyInfo of the certificate
| cert | the certificate to inspect |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 695 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 ) |
Get the serial number of the certificate as a big-endian binary string
| cert | the certificate to inspect |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 636 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 ) |
Enumerates the names of the given key in the subject DN. If index is out of bounds, BOTAN_FFI_ERROR_BAD_PARAMETER is returned.
TODO(Botan4) use BOTAN_FFI_ERROR_OUT_OF_RANGE instead of BAD_PARAMETER TODO(Botan4) this should use char for the out param
Definition at line 494 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::write_str_output().
| int botan_x509_cert_get_subject_dn_count | ( | botan_x509_cert_t | cert, |
| const char * | key, | ||
| size_t * | count ) |
Count the names of the given key present in the subject DN.
| cert | the certificate to inspect |
| key | the DN component to count, eg "Name" |
| count | set to the number of available entries |
Definition at line 515 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_get_subject_key_id | ( | botan_x509_cert_t | cert, |
| uint8_t | out[], | ||
| size_t * | out_len ) |
Get the subject key identifier extension
| cert | the certificate to inspect |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 686 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 ) |
Get the end of the validity period as a string
Prefer botan_x509_cert_not_after
| cert | the certificate to inspect |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 602 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 ) |
Get the start of the validity period as a string
Prefer botan_x509_cert_not_before
| cert | the certificate to inspect |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 592 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 936 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_is_ca | ( | botan_x509_cert_t | cert | ) |
Returns 1 iff the cert is a CA certificate
Definition at line 410 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_issuer_alternative_names | ( | botan_x509_cert_t | cert, |
| size_t | index, | ||
| botan_x509_general_name_t * | alt_name ) |
Provides access to all "issuer alternative names", where each entry is returned as a botan_x509_general_name_t. If the given index is not within range of the available entries, BOTAN_FFI_ERROR_OUT_OF_RANGE is returned. If cert does not contain an IssuerAlternativeNames extension, BOTAN_FFI_ERROR_NO_VALUE is returned.
Definition at line 897 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan::Extensions::extension_set(), Botan_FFI::ffi_new_object(), Botan::OID::from_string(), Botan::X509_Certificate::issuer_alt_name(), and Botan::X509_Certificate::v3_extensions().
| int botan_x509_cert_issuer_alternative_names_count | ( | botan_x509_cert_t | cert, |
| size_t * | count ) |
Count the "issuer alternative names" of a given cert.
| cert | the certificate to inspect |
| count | set to the number of available entries |
Definition at line 922 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan::X509_Certificate::issuer_alt_name().
| int botan_x509_cert_load | ( | botan_x509_cert_t * | cert_obj, |
| const uint8_t | cert[], | ||
| size_t | cert_len ) |
Load a certificate from a DER or PEM encoding
| cert_obj | the new object will be placed here |
| cert | the encoding to load |
| cert_len | length of cert in bytes |
Definition at line 211 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().
| int botan_x509_cert_load_file | ( | botan_x509_cert_t * | cert_obj, |
| const char * | filename ) |
Load a certificate from a file containing a DER or PEM encoding
| cert_obj | the new object will be placed here |
| filename | path of the file to read |
Definition at line 176 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().
| int botan_x509_cert_not_after | ( | botan_x509_cert_t | cert, |
| uint64_t * | time_since_epoch ) |
Get the end of the validity period as seconds since the Unix epoch
| cert | the certificate to inspect |
| time_since_epoch | set to the notAfter time |
Definition at line 624 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_not_before | ( | botan_x509_cert_t | cert, |
| uint64_t * | time_since_epoch ) |
Get the start of the validity period as seconds since the Unix epoch
| cert | the certificate to inspect |
| time_since_epoch | set to the notBefore time |
Definition at line 612 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_permitted_name_constraints | ( | botan_x509_cert_t | cert, |
| size_t | index, | ||
| botan_x509_general_name_t * | constraint ) |
Extracts "permitted" name constraints from a given cert one-by-one. Returns BOTAN_FFI_ERROR_OUT_OF_RANGE if the given index is larger than the available number of "permitted" name constraints.
Definition at line 788 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan_FFI::ffi_new_object(), Botan::X509_Certificate::name_constraints(), and Botan::NameConstraints::permitted().
| int botan_x509_cert_permitted_name_constraints_count | ( | botan_x509_cert_t | cert, |
| size_t * | count ) |
Count the "permitted" name constraints of a given cert.
| cert | the certificate to inspect |
| count | set to the number of available entries |
Definition at line 810 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_cert_serial_number | ( | botan_x509_cert_t | cert, |
| botan_mp_t * | serial_number ) |
Get the serial number of the certificate as an integer
| cert | the certificate to inspect |
| serial_number | the new object will be placed here |
Definition at line 645 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan_FFI::ffi_new_object(), Botan::X509_Certificate::serial(), and Botan::X509_Serial_Number::to_bigint().
| int botan_x509_cert_subject_alternative_names | ( | botan_x509_cert_t | cert, |
| size_t | index, | ||
| botan_x509_general_name_t * | alt_name ) |
Provides access to all "subject alternative names", where each entry is returned as a botan_x509_general_name_t. If the given index is not within range of the available entries, BOTAN_FFI_ERROR_OUT_OF_RANGE is returned. If cert does not contain a SubjectAlternativeNames extension, BOTAN_FFI_ERROR_NO_VALUE is returned.
Definition at line 858 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan::Extensions::extension_set(), Botan_FFI::ffi_new_object(), Botan::OID::from_string(), Botan::X509_Certificate::subject_alt_name(), and Botan::X509_Certificate::v3_extensions().
| int botan_x509_cert_subject_alternative_names_count | ( | botan_x509_cert_t | cert, |
| size_t * | count ) |
Count the "subject alternative names" of a given cert.
| cert | the certificate to inspect |
| count | set to the number of available entries |
Definition at line 883 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan::X509_Certificate::subject_alt_name().
| int botan_x509_cert_to_string | ( | botan_x509_cert_t | cert, |
| char | out[], | ||
| size_t * | out_len ) |
Format the certificate as a human readable string
| cert | the certificate to format |
| out | output buffer |
| out_len | on input the size of out, on output the number of bytes written or required |
Definition at line 531 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 1023 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 949 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, 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 1433 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, 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 ) |
View the certificate formatted as a human readable string
| cert | the certificate to format |
| ctx | an application context passed to the view function |
| view | the view callback which receives the string |
Definition at line 535 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_binary_values | ( | botan_x509_cert_t | cert, |
| botan_x509_value_type | value_type, | ||
| size_t | index, | ||
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
Retrieve a specific binary value from an X.509 certificate.
For multi-values index allows enumerating the available entries, until BOTAN_FFI_ERROR_OUT_OF_RANGE is returned. For singleton values, an index of value "0" is expected.
cert does not provide the requested value_type at all or not in binary format. Definition at line 285 of file ffi_cert.cpp.
References Botan::X509_Certificate::authority_key_id(), BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_AUTHORITY_KEY_IDENTIFIER, BOTAN_X509_CA_ISSUERS_URLS, BOTAN_X509_CRL_DISTRIBUTION_URLS, BOTAN_X509_DER_ENCODING, BOTAN_X509_ISSUER_DN_BITS, BOTAN_X509_OCSP_RESPONDER_URLS, BOTAN_X509_PEM_ENCODING, BOTAN_X509_PUBLIC_KEY_PKCS8_BITS, BOTAN_X509_SERIAL_NUMBER, BOTAN_X509_SIGNATURE_BITS, BOTAN_X509_SIGNATURE_SCHEME_BITS, BOTAN_X509_SUBJECT_DN_BITS, BOTAN_X509_SUBJECT_KEY_IDENTIFIER, BOTAN_X509_TBS_DATA_BITS, Botan_FFI::invoke_view_callback(), Botan::X509_Certificate::raw_issuer_dn(), Botan::X509_Certificate::raw_subject_dn(), Botan::X509_Certificate::serial_number(), Botan::X509_Certificate::subject_key_id(), and Botan::X509_Certificate::subject_public_key_info().
Referenced by botan_x509_cert_view_binary_values_count().
| int botan_x509_cert_view_binary_values_count | ( | botan_x509_cert_t | cert, |
| botan_x509_value_type | value_type, | ||
| size_t * | count ) |
Count the binary values of the given type available in an X.509 certificate.
| cert | the certificate to inspect |
| value_type | the value type to count |
| count | set to the number of available entries |
Definition at line 340 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, and botan_x509_cert_view_binary_values().
| int botan_x509_cert_view_public_key_bits | ( | botan_x509_cert_t | cert, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the DER encoded SubjectPublicKeyInfo of the certificate
| cert | the certificate to inspect |
| ctx | an application context passed to the view function |
| view | the view callback which receives the encoding |
Definition at line 699 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_cert_view_string_values | ( | botan_x509_cert_t | cert, |
| botan_x509_value_type | value_type, | ||
| size_t | index, | ||
| botan_view_ctx | ctx, | ||
| botan_view_str_fn | view ) |
Retrieve a specific string value from an X.509 certificate.
For multi-values index allows enumerating the available entries, until BOTAN_FFI_ERROR_OUT_OF_RANGE is returned. For singleton values, an index of value "0" is expected.
cert does not provide the requested value_type at all or not in string format. Definition at line 352 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_AUTHORITY_KEY_IDENTIFIER, BOTAN_X509_CA_ISSUERS_URLS, BOTAN_X509_CRL_DISTRIBUTION_URLS, BOTAN_X509_DER_ENCODING, BOTAN_X509_ISSUER_DN_BITS, BOTAN_X509_OCSP_RESPONDER_URLS, BOTAN_X509_PEM_ENCODING, BOTAN_X509_PUBLIC_KEY_PKCS8_BITS, BOTAN_X509_SERIAL_NUMBER, BOTAN_X509_SIGNATURE_BITS, BOTAN_X509_SIGNATURE_SCHEME_BITS, BOTAN_X509_SUBJECT_DN_BITS, BOTAN_X509_SUBJECT_KEY_IDENTIFIER, BOTAN_X509_TBS_DATA_BITS, Botan::X509_Certificate::ca_issuer_uris(), Botan::X509_Certificate::crl_distribution_point_uris(), Botan_FFI::invoke_view_callback(), and Botan::X509_Certificate::ocsp_responder_uris().
Referenced by botan_x509_cert_view_string_values_count().
| int botan_x509_cert_view_string_values_count | ( | botan_x509_cert_t | cert, |
| botan_x509_value_type | value_type, | ||
| size_t * | count ) |
Count the string values of the given type available in an X.509 certificate.
| cert | the certificate to inspect |
| value_type | the value type to count |
| count | set to the number of available entries |
Definition at line 398 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, and botan_x509_cert_view_string_values().
| int botan_x509_crl_create | ( | botan_x509_crl_t * | crl_obj, |
| botan_rng_t | rng, | ||
| botan_x509_cert_t | ca_cert, | ||
| botan_privkey_t | ca_key, | ||
| uint64_t | issue_time, | ||
| uint32_t | next_update, | ||
| const char * | hash_fn, | ||
| const char * | padding ) |
Create a new CRL
| crl_obj | The newly created CRL |
| Random Number Generators | a random number generator object |
| ca_cert | The CA Certificate the CRL belongs to |
| ca_key | The private key of that CA |
| issue_time | The time when the CRL becomes valid |
| next_update | The number of seconds after issue_time until the CRL expires |
| hash_fn | The hash function to use, may be null |
| padding | The padding to use, may be null |
Definition at line 1106 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get().
| int botan_x509_crl_destroy | ( | botan_x509_crl_t | crl | ) |
Frees all resources of the CRL object
| crl | the CRL to destroy |
Definition at line 1196 of file ffi_cert.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
| int botan_x509_crl_entries | ( | botan_x509_crl_t | crl, |
| size_t | index, | ||
| botan_x509_crl_entry_t * | entry ) |
Allows iterating all entries of the CRL.
| crl | the CRL whose entries should be listed |
| index | the index of the CRL entry to return |
| entry | an object handle containing the CRL entry data |
index is out of range of the CRL entry list. Definition at line 1333 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan_FFI::ffi_new_object(), and Botan::X509_CRL::get_revoked().
| int botan_x509_crl_entries_count | ( | botan_x509_crl_t | crl, |
| size_t * | count ) |
Count the entries of the CRL.
| crl | the CRL whose entries should be counted |
| count | set to the number of available entries |
Definition at line 1353 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan::X509_CRL::get_revoked().
| int botan_x509_crl_entry_create | ( | botan_x509_crl_entry_t * | entry, |
| botan_x509_cert_t | cert, | ||
| int | reason_code ) |
Create a new CRL entry that marks cert as revoked
| entry | The newly created CRL entry |
| cert | The certificate to mark as revoked |
| reason_code | The reason code for revocation |
Definition at line 1132 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get().
| int botan_x509_crl_entry_destroy | ( | botan_x509_crl_entry_t | entry | ) |
Frees all resources of the CRL entry object
| entry | the CRL entry to destroy |
Definition at line 1366 of file ffi_cert.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
| int botan_x509_crl_entry_reason | ( | botan_x509_crl_entry_t | entry, |
| int * | reason_code ) |
Return the revocation reason code for the given CRL entry. See botan_x509_crl_reason_code and RFC 5280 - 5.3.1 for possible reason codes.
Definition at line 1375 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan::CRL_Entry::reason_code().
| int botan_x509_crl_entry_revocation_date | ( | botan_x509_crl_entry_t | entry, |
| uint64_t * | time_since_epoch ) |
Return the revocation date for the given CRL entry as time since epoch in seconds.
Definition at line 1417 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan::CRL_Entry::expire_time(), and Botan::ASN1_Time::time_since_epoch().
| int botan_x509_crl_entry_serial_number | ( | botan_x509_crl_entry_t | entry, |
| botan_mp_t * | serial_number ) |
Return the serial number associated with the given CRL entry.
Definition at line 1391 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan_FFI::ffi_new_object(), Botan::CRL_Entry::serial(), and Botan::X509_Serial_Number::to_bigint().
| int botan_x509_crl_entry_view_serial_number | ( | botan_x509_crl_entry_t | entry, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
View the serial number associated with the given CRL entry.
Definition at line 1407 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, Botan_FFI::invoke_view_callback(), and Botan::CRL_Entry::serial_number().
| int botan_x509_crl_load | ( | botan_x509_crl_t * | crl_obj, |
| const uint8_t | crl_bits[], | ||
| size_t | crl_bits_len ) |
Load a CRL from a DER or PEM encoding
| crl_obj | the new object will be placed here |
| crl_bits | the encoding to load |
| crl_bits_len | length of crl_bits in bytes |
Definition at line 1053 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().
| int botan_x509_crl_load_file | ( | botan_x509_crl_t * | crl_obj, |
| const char * | crl_path ) |
Load a CRL from a file containing a DER or PEM encoding
| crl_obj | the new object will be placed here |
| crl_path | path of the file to read |
Definition at line 1036 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().
| int botan_x509_crl_next_update | ( | botan_x509_crl_t | crl, |
| uint64_t * | time_since_epoch ) |
Get the nextUpdate field of the CRL as seconds since the Unix epoch
| crl | the CRL to inspect |
| time_since_epoch | set to the nextUpdate time |
Definition at line 1085 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_crl_this_update | ( | botan_x509_crl_t | crl, |
| uint64_t * | time_since_epoch ) |
Get the thisUpdate field of the CRL as seconds since the Unix epoch
| crl | the CRL to inspect |
| time_since_epoch | set to the thisUpdate time |
Definition at line 1070 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
| int botan_x509_crl_update | ( | botan_x509_crl_t * | crl_obj, |
| botan_x509_crl_t | last_crl, | ||
| botan_rng_t | rng, | ||
| botan_x509_cert_t | ca_cert, | ||
| botan_privkey_t | ca_key, | ||
| uint64_t | issue_time, | ||
| uint32_t | next_update, | ||
| const botan_x509_crl_entry_t * | new_entries, | ||
| size_t | new_entries_len, | ||
| const char * | hash_fn, | ||
| const char * | padding ) |
Update a CRL with new revoked entries. This does not modify the old crl, and instead creates a new one.
| crl_obj | The newly created CRL |
| last_crl | The CRL to update |
| Random Number Generators | a random number generator object |
| ca_cert | The CA Certificate the CRL belongs to |
| ca_key | The private key of that CA |
| issue_time | The time when the CRL becomes valid |
| next_update | The number of seconds after issue_time until the CRL expires |
| new_entries | The entries to add to the CRL |
| new_entries_len | The number of entries |
| hash_fn | The hash function to use, may be null |
| padding | The padding to use, may be null |
Definition at line 1147 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get().
| int botan_x509_crl_verify_signature | ( | botan_x509_crl_t | crl, |
| botan_pubkey_t | key ) |
Check the signature on a CRL against the issuer's public key
| crl | the CRL to verify |
| key | the public key of the issuing CA |
Definition at line 1187 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::safe_get().
| int botan_x509_crl_view_binary_values | ( | botan_x509_crl_t | crl_obj, |
| botan_x509_value_type | value_type, | ||
| size_t | index, | ||
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
Retrieve a specific binary value from an X.509 certificate revocation list.
For multi-values index allows enumerating the available entries, until BOTAN_FFI_ERROR_OUT_OF_RANGE is returned. For singleton values, an index of value "0" is expected.
crl_obj does not provide the requested value_type at all or not in binary format. Definition at line 1205 of file ffi_cert.cpp.
References Botan::X509_CRL::authority_key_id(), BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_OUT_OF_RANGE, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_AUTHORITY_KEY_IDENTIFIER, BOTAN_X509_CA_ISSUERS_URLS, BOTAN_X509_CRL_DISTRIBUTION_URLS, BOTAN_X509_DER_ENCODING, BOTAN_X509_ISSUER_DN_BITS, BOTAN_X509_OCSP_RESPONDER_URLS, BOTAN_X509_PEM_ENCODING, BOTAN_X509_PUBLIC_KEY_PKCS8_BITS, BOTAN_X509_SERIAL_NUMBER, BOTAN_X509_SIGNATURE_BITS, BOTAN_X509_SIGNATURE_SCHEME_BITS, BOTAN_X509_SUBJECT_DN_BITS, BOTAN_X509_SUBJECT_KEY_IDENTIFIER, BOTAN_X509_TBS_DATA_BITS, Botan::X509_CRL::crl_number_bigint(), Botan::X509_DN::get_bits(), Botan_FFI::invoke_view_callback(), Botan::X509_CRL::issuer_dn(), and Botan::ASN1::put_in_sequence().
Referenced by botan_x509_crl_view_binary_values_count().
| int botan_x509_crl_view_binary_values_count | ( | botan_x509_crl_t | crl_obj, |
| botan_x509_value_type | value_type, | ||
| size_t * | count ) |
Count the binary values of the given type available in a CRL.
| crl_obj | the CRL to inspect |
| value_type | the value type to count |
| count | set to the number of available entries |
Definition at line 1264 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, and botan_x509_crl_view_binary_values().
| int botan_x509_crl_view_string_values | ( | botan_x509_crl_t | crl_obj, |
| botan_x509_value_type | value_type, | ||
| size_t | index, | ||
| botan_view_ctx | ctx, | ||
| botan_view_str_fn | view ) |
Retrieve a specific string value from an X.509 certificate revocation list.
For multi-values index allows enumerating the available entries, until BOTAN_FFI_ERROR_OUT_OF_RANGE is returned. For singleton values, an index of value "0" is expected.
crl_obj does not provide the requested value_type at all or not in string format. Definition at line 1276 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NO_VALUE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_AUTHORITY_KEY_IDENTIFIER, BOTAN_X509_CA_ISSUERS_URLS, BOTAN_X509_CRL_DISTRIBUTION_URLS, BOTAN_X509_DER_ENCODING, BOTAN_X509_ISSUER_DN_BITS, BOTAN_X509_OCSP_RESPONDER_URLS, BOTAN_X509_PEM_ENCODING, BOTAN_X509_PUBLIC_KEY_PKCS8_BITS, BOTAN_X509_SERIAL_NUMBER, BOTAN_X509_SIGNATURE_BITS, BOTAN_X509_SIGNATURE_SCHEME_BITS, BOTAN_X509_SUBJECT_DN_BITS, BOTAN_X509_SUBJECT_KEY_IDENTIFIER, and BOTAN_X509_TBS_DATA_BITS.
Referenced by botan_x509_crl_view_string_values_count().
| int botan_x509_crl_view_string_values_count | ( | botan_x509_crl_t | crl_obj, |
| botan_x509_value_type | value_type, | ||
| size_t * | count ) |
Count the string values of the given type available in a CRL.
| crl_obj | the CRL to inspect |
| value_type | the value type to count |
| count | set to the number of available entries |
Definition at line 1311 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, and botan_x509_crl_view_string_values().
| int botan_x509_general_name_destroy | ( | botan_x509_general_name_t | alt_names | ) |
Frees all resources of the GeneralName object
| alt_names | the GeneralName to destroy |
Definition at line 779 of file ffi_cert.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
| int botan_x509_general_name_get_type | ( | botan_x509_general_name_t | name, |
| unsigned int * | type ) |
Provides the contained type of the name and returns BOTAN_FFI_SUCCESS if that type is supported and may be retrieved via the view functions below. Otherwise BOTAN_FFI_ERROR_INVALID_OBJECT_STATE is returned.
Definition at line 709 of file ffi_cert.cpp.
References Botan::any_null_pointers(), BOTAN_FFI_ERROR_INVALID_OBJECT_STATE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_OTHER_NAME, and Botan::GeneralName::type_code().
| int botan_x509_general_name_view_binary_value | ( | botan_x509_general_name_t | name, |
| botan_view_ctx | ctx, | ||
| botan_view_bin_fn | view ) |
Views the name as a bit string or returns BOTAN_FFI_ERROR_INVALID_OBJECT_STATE if the contained GeneralName value cannot be represented as a binary string.
The types BOTAN_X509_DIRECTORY_NAME, BOTAN_X509_IP_ADDRESS may be viewed as "binary".
Definition at line 757 of file ffi_cert.cpp.
References Botan::GeneralName::binary_name(), BOTAN_FFI_ERROR_INVALID_OBJECT_STATE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_DIRECTORY_NAME, BOTAN_X509_IP_ADDRESS, Botan_FFI::invoke_view_callback(), and Botan::GeneralName::type_code().
| int botan_x509_general_name_view_string_value | ( | botan_x509_general_name_t | name, |
| botan_view_ctx | ctx, | ||
| botan_view_str_fn | view ) |
Views the name as a string or returns BOTAN_FFI_ERROR_INVALID_OBJECT_STATE if the contained GeneralName value cannot be represented as a string.
The types BOTAN_X509_EMAIL_ADDRESS, BOTAN_X509_DNS_NAME, BOTAN_X509_URI, BOTAN_X509_IP_ADDRESS may be viewed as "string".
Definition at line 734 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_INVALID_OBJECT_STATE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, BOTAN_X509_DNS_NAME, BOTAN_X509_EMAIL_ADDRESS, BOTAN_X509_IP_ADDRESS, BOTAN_X509_URI, Botan_FFI::invoke_view_callback(), Botan::GeneralName::name(), and Botan::GeneralName::type_code().
| 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 1323 of file ffi_cert.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::safe_get().