X.509 certificate and certification-path verification interface. More...
Go to the source code of this file.
Data Structures | |
| struct | qsc_x509_verify_options_t |
Typedefs | |
| typedef enum qsc_x509_verify_status_t | qsc_x509_verify_status |
| typedef bool(* | qsc_x509_signature_verify_callback) (const qsc_x509_certificate *certificate, const qsc_x509_certificate *issuer, void *state) |
| Caller-supplied certificate signature verification callback. | |
| typedef enum qsc_x509_verify_purpose_t | qsc_x509_verify_purpose |
| typedef struct qsc_x509_verify_options_t | qsc_x509_verify_options |
Functions | |
| QSC_EXPORT_API void | qsc_x509_verify_options_initialize (qsc_x509_verify_options *options) |
| Initialize a verification options structure. | |
| QSC_EXPORT_API bool | qsc_x509_certificate_is_self_issued (const qsc_x509_certificate *certificate) |
| Test whether a certificate is self-issued. | |
| QSC_EXPORT_API bool | qsc_x509_certificate_is_self_signed (const qsc_x509_certificate *certificate, qsc_x509_signature_verify_callback callback, void *state) |
| Test whether a certificate is self-signed. | |
| QSC_EXPORT_API bool | qsc_x509_certificate_is_ca (const qsc_x509_certificate *certificate) |
| Test whether a certificate is authorized to act as a CA. | |
| QSC_EXPORT_API bool | qsc_x509_certificate_allows_server_auth (const qsc_x509_certificate *certificate) |
| Test whether a certificate allows TLS server authentication. | |
| QSC_EXPORT_API bool | qsc_x509_certificate_allows_client_auth (const qsc_x509_certificate *certificate) |
| Test whether a certificate allows TLS client authentication. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_structure (const qsc_x509_certificate *certificate) |
| Check RFC-aligned certificate structural invariants. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_algorithms (const qsc_x509_certificate *certificate) |
| Check certificate algorithm consistency. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_validity (const qsc_x509_certificate *certificate, const qsc_asn1_time *ascnow) |
| Check certificate validity at a supplied time. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_purpose (const qsc_x509_certificate *certificate, qsc_x509_verify_purpose purpose) |
| Check certificate suitability for a requested purpose. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_hostname (const qsc_x509_certificate *certificate, const char *hostname) |
| Check whether a certificate matches a hostname. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_ip_address (const qsc_x509_certificate *certificate, const uint8_t *address, size_t addresslen) |
| Check whether a certificate matches an IP address. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_check_issuer (const qsc_x509_certificate *issuer, const qsc_x509_certificate *subject, size_t remainingdepth) |
| Check whether one certificate may issue another. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_verify (const qsc_x509_certificate *certificate, const qsc_x509_certificate *issuer, const qsc_asn1_time *now, qsc_x509_signature_verify_callback callback, void *state) |
| Verify a certificate against its issuer. | |
| QSC_EXPORT_API bool | qsc_x509_chain_is_anchored (const qsc_x509_chain *chain, const qsc_x509_store *store) |
| Test whether a chain terminates at a trusted anchor. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_chain_verify (const qsc_x509_chain *chain, const qsc_x509_store *store, const qsc_asn1_time *now, qsc_x509_signature_verify_callback callback, void *state) |
| Verify a certification chain. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_certificate_verify_ex (const qsc_x509_certificate *certificate, const qsc_x509_certificate *issuer, const qsc_asn1_time *now, qsc_x509_signature_verify_callback callback, void *state, const qsc_x509_verify_options *options) |
| Verify a certificate against its issuer using extended options. | |
| QSC_EXPORT_API qsc_x509_verify_status | qsc_x509_chain_verify_ex (const qsc_x509_chain *chain, const qsc_x509_store *store, const qsc_asn1_time *now, qsc_x509_signature_verify_callback callback, void *state, const qsc_x509_verify_options *options) |
| Verify a certification chain using extended options. | |
X.509 certificate and certification-path verification interface.
This header defines the status codes, callback types, verification-purpose selectors, option container, and helper functions used to validate X.509 certificates and certification chains. The interface supports algorithm consistency checks, validity-window evaluation, issuer relationship checks, name and endpoint validation, CA and key-usage policy enforcement, signature verification through a caller-supplied callback, and optional revocation processing through the revocation subsystem.
| typedef bool(* qsc_x509_signature_verify_callback) (const qsc_x509_certificate *certificate, const qsc_x509_certificate *issuer, void *state) |
Caller-supplied certificate signature verification callback.
This callback performs cryptographic verification of a subject certificate signature using the supplied issuer certificate and caller-defined state.
| certificate | [const][struct] The certificate whose signature is to be verified. |
| issuer | [const][struct] The issuer certificate providing the verification key. |
| state | Caller-defined opaque verification context. |
| QSC_EXPORT_API bool qsc_x509_certificate_allows_client_auth | ( | const qsc_x509_certificate * | certificate | ) |
Test whether a certificate allows TLS client authentication.
Evaluates the certificate key usage and extended key usage constraints for TLS client-auth applicability.
| certificate | [const][struct] The certificate to inspect. |
| QSC_EXPORT_API bool qsc_x509_certificate_allows_server_auth | ( | const qsc_x509_certificate * | certificate | ) |
Test whether a certificate allows TLS server authentication.
Evaluates the certificate key usage and extended key usage constraints for TLS server-auth applicability.
| certificate | [const][struct] The certificate to inspect. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_algorithms | ( | const qsc_x509_certificate * | certificate | ) |
Check certificate algorithm consistency.
Validates the internal consistency of certificate signature algorithm metadata, signature encoding constraints, and related algorithm fields.
| certificate | [const][struct] The certificate to inspect. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_hostname | ( | const qsc_x509_certificate * | certificate, |
| const char * | hostname ) |
Check whether a certificate matches a hostname.
Evaluates the certificate identity information against the supplied DNS host name.
| certificate | [const][struct] The certificate to inspect. |
| hostname | [const] The hostname to match. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_ip_address | ( | const qsc_x509_certificate * | certificate, |
| const uint8_t * | address, | ||
| size_t | addresslen ) |
Check whether a certificate matches an IP address.
Evaluates the certificate identity information against the supplied binary IP address.
| certificate | [const][struct] The certificate to inspect. |
| address | [const] The binary IP address to match. |
| addresslen | The length of the IP address in bytes. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_issuer | ( | const qsc_x509_certificate * | issuer, |
| const qsc_x509_certificate * | subject, | ||
| size_t | remainingdepth ) |
Check whether one certificate may issue another.
Evaluates issuer-subject name relationships, key identifiers, CA status, path-length constraints, and related issuer policy requirements.
| issuer | [const][struct] The candidate issuer certificate. |
| subject | [const][struct] The candidate subject certificate. |
| remainingdepth | The remaining allowable certification-path depth. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_purpose | ( | const qsc_x509_certificate * | certificate, |
| qsc_x509_verify_purpose | purpose ) |
Check certificate suitability for a requested purpose.
Evaluates the certificate against the requested application purpose, including usage and purpose constraints where applicable.
| certificate | [const][struct] The certificate to inspect. |
| purpose | [enum] The requested verification purpose. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_structure | ( | const qsc_x509_certificate * | certificate | ) |
Check RFC-aligned certificate structural invariants.
Validates certificate-local structural rules that do not require issuer, trust-store, or time context. This includes version and extension compatibility, empty-subject handling, CA and key-usage coherence, and subject public-key algorithm suitability.
| certificate | [const][struct] The certificate to inspect. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_check_validity | ( | const qsc_x509_certificate * | certificate, |
| const qsc_asn1_time * | ascnow ) |
Check certificate validity at a supplied time.
Evaluates the certificate notBefore and notAfter fields relative to the supplied evaluation time.
| certificate | [const][struct] The certificate to inspect. |
| ascnow | [const][struct] The evaluation time. |
| QSC_EXPORT_API bool qsc_x509_certificate_is_ca | ( | const qsc_x509_certificate * | certificate | ) |
Test whether a certificate is authorized to act as a CA.
Evaluates the Basic Constraints and related policy indicators to determine whether the certificate may act as a certification authority.
| certificate | [const][struct] The certificate to inspect. |
| QSC_EXPORT_API bool qsc_x509_certificate_is_self_issued | ( | const qsc_x509_certificate * | certificate | ) |
Test whether a certificate is self-issued.
Determines whether the certificate subject and issuer names are equivalent, indicating that the certificate is self-issued.
| certificate | [const][struct] The certificate to inspect. |
| QSC_EXPORT_API bool qsc_x509_certificate_is_self_signed | ( | const qsc_x509_certificate * | certificate, |
| qsc_x509_signature_verify_callback | callback, | ||
| void * | state ) |
Test whether a certificate is self-signed.
Determines whether the certificate is self-issued and whether its signature validates under its own subject public key through the caller-supplied verification callback.
| certificate | [const][struct] The certificate to inspect. |
| callback | The caller-supplied signature verification callback. |
| state | Caller-defined opaque verification context. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_verify | ( | const qsc_x509_certificate * | certificate, |
| const qsc_x509_certificate * | issuer, | ||
| const qsc_asn1_time * | now, | ||
| qsc_x509_signature_verify_callback | callback, | ||
| void * | state ) |
Verify a certificate against its issuer.
Performs core certificate validation, including algorithm checks, validity checks, issuer relationship validation, and cryptographic signature verification through the supplied callback.
| certificate | [const][struct] The certificate to verify. |
| issuer | [const][struct] The issuer certificate. |
| now | [const][struct] The evaluation time. |
| callback | The caller-supplied signature verification callback. |
| state | Caller-defined opaque verification context. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_certificate_verify_ex | ( | const qsc_x509_certificate * | certificate, |
| const qsc_x509_certificate * | issuer, | ||
| const qsc_asn1_time * | now, | ||
| qsc_x509_signature_verify_callback | callback, | ||
| void * | state, | ||
| const qsc_x509_verify_options * | options ) |
Verify a certificate against its issuer using extended options.
Performs certificate verification with additional policy controls, including requested purpose validation, optional revocation processing, and optional unsupported-critical-extension rejection.
| certificate | [const][struct] The certificate to verify. |
| issuer | [const][struct] The issuer certificate. |
| now | [const][struct] The evaluation time. |
| callback | The caller-supplied signature verification callback. |
| state | Caller-defined opaque verification context. |
| options | [const][struct] Optional extended verification controls. |
| QSC_EXPORT_API bool qsc_x509_chain_is_anchored | ( | const qsc_x509_chain * | chain, |
| const qsc_x509_store * | store ) |
Test whether a chain terminates at a trusted anchor.
Determines whether the supplied certification chain is anchored in the provided trust store.
| chain | [const][struct] The certification chain to inspect. |
| store | [const][struct] The trust store containing candidate anchors. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_chain_verify | ( | const qsc_x509_chain * | chain, |
| const qsc_x509_store * | store, | ||
| const qsc_asn1_time * | now, | ||
| qsc_x509_signature_verify_callback | callback, | ||
| void * | state ) |
Verify a certification chain.
Performs ordered validation of the certificates in the chain, checks that the path terminates at a trust anchor in the supplied store, and applies cryptographic signature verification through the caller-supplied callback.
| chain | [const][struct] The certification chain to verify. |
| store | [const][struct] The trust store containing candidate anchors. |
| now | [const][struct] The evaluation time. |
| callback | The caller-supplied signature verification callback. |
| state | Caller-defined opaque verification context. |
| QSC_EXPORT_API qsc_x509_verify_status qsc_x509_chain_verify_ex | ( | const qsc_x509_chain * | chain, |
| const qsc_x509_store * | store, | ||
| const qsc_asn1_time * | now, | ||
| qsc_x509_signature_verify_callback | callback, | ||
| void * | state, | ||
| const qsc_x509_verify_options * | options ) |
Verify a certification chain using extended options.
Performs certification-path verification with additional policy controls, including requested purpose validation, optional revocation processing, and optional unsupported-critical-extension rejection.
| chain | [const][struct] The certification chain to verify. |
| store | [const][struct] The trust store containing candidate anchors. |
| now | [const][struct] The evaluation time. |
| callback | The caller-supplied signature verification callback. |
| state | Caller-defined opaque verification context. |
| options | [const][struct] Optional extended verification controls. |
| QSC_EXPORT_API void qsc_x509_verify_options_initialize | ( | qsc_x509_verify_options * | options | ) |
Initialize a verification options structure.
Resets the verification options object to a clean default state suitable for subsequent policy configuration.
| options | [struct] The verification options structure to initialize. |