High-level offline X.509 wrapper for certificate loading, validation, deployment configuration, trust-store management, provisioning, and TLS bridge integration. More...
#include "qsccommon.h"#include "x509cert.h"#include "x509certwrite.h"#include "x509crl.h"#include "x509csr.h"#include "x509key.h"#include "x509keywrite.h"#include "x509name.h"#include "x509pem.h"#include "x509sigver.h"#include "x509store.h"#include "x509time.h"#include "x509verify.h"#include "tlscert.h"#include "tlslimits.h"Go to the source code of this file.
Data Structures | |
| struct | qsc_x509w_profile_t |
| Validation profile describing the intended certificate-verification policy. More... | |
| struct | qsc_x509w_result_t |
| Structured operational result returned by wrapper validation and configuration routines. More... | |
| struct | qsc_x509w_trust_store_t |
| Wrapper-owned trust-store object containing anchors, CRLs, and the underlying QSC store state. More... | |
| struct | qsc_x509w_server_identity_t |
| Wrapper-owned server identity consisting of a leaf certificate, optional intermediates, and the associated private key. More... | |
| struct | qsc_x509w_deployment_config_t |
| File-path and policy configuration used to load server identities and trust material for deployment workflows. More... | |
| struct | qsc_x509w_tls_bridge_t |
| Thin TLS bridge object binding wrapper validation policy and trust material to the QSC TLS certificate interface. More... | |
| struct | qsc_x509w_tls_local_certificate_t |
| TLS-facing export container for a local certificate chain and private key for CertificateVerify generation. More... | |
Typedefs | |
| typedef enum qsc_x509w_status_t | qsc_x509w_status |
| typedef enum qsc_x509w_stage_t | qsc_x509w_stage |
| typedef enum qsc_x509w_certificate_role_t | qsc_x509w_certificate_role |
| typedef enum qsc_x509w_profile_preset_t | qsc_x509w_profile_preset |
| typedef enum qsc_x509w_revocation_mode_t | qsc_x509w_revocation_mode |
| typedef enum qsc_x509w_locator_policy_t | qsc_x509w_locator_policy |
| typedef enum qsc_x509w_revocation_source_t | qsc_x509w_revocation_source |
| typedef enum qsc_x509w_availability_t | qsc_x509w_availability |
| typedef struct qsc_x509w_profile_t | qsc_x509w_profile |
| typedef struct qsc_x509w_result_t | qsc_x509w_result |
| typedef struct qsc_x509w_trust_store_t | qsc_x509w_trust_store |
| typedef struct qsc_x509w_server_identity_t | qsc_x509w_server_identity |
| typedef struct qsc_x509w_deployment_config_t | qsc_x509w_deployment_config |
| typedef struct qsc_x509w_tls_bridge_t | qsc_x509w_tls_bridge |
| typedef struct qsc_x509w_tls_local_certificate_t | qsc_x509w_tls_local_certificate |
Functions | |
| QSC_EXPORT_API void | qsc_x509w_profile_initialize (qsc_x509w_profile *profile) |
| Initialize a validation profile to wrapper defaults. | |
| QSC_EXPORT_API void | qsc_x509w_profile_apply_preset (qsc_x509w_profile *profile, qsc_x509w_profile_preset preset) |
| Apply a predefined validation-profile preset. | |
| QSC_EXPORT_API void | qsc_x509w_profile_set_tls_server_defaults (qsc_x509w_profile *profile) |
| Set TLS server validation defaults in a profile. | |
| QSC_EXPORT_API void | qsc_x509w_profile_set_tls_client_defaults (qsc_x509w_profile *profile) |
| Set TLS client validation defaults in a profile. | |
| QSC_EXPORT_API void | qsc_x509w_profile_set_ca_defaults (qsc_x509w_profile *profile) |
| Set CA-validation defaults in a profile. | |
| QSC_EXPORT_API void | qsc_x509w_profile_set_strict_revocation_defaults (qsc_x509w_profile *profile) |
| Set strict revocation defaults in a profile. | |
| QSC_EXPORT_API void | qsc_x509w_profile_set_development_defaults (qsc_x509w_profile *profile) |
| Set relaxed development defaults in a profile. | |
| QSC_EXPORT_API void | qsc_x509w_result_initialize (qsc_x509w_result *result) |
| Initialize a wrapper result object to its default state. | |
| QSC_EXPORT_API void | qsc_x509w_trust_store_initialize (qsc_x509w_trust_store *store) |
| Initialize a wrapper trust store. | |
| QSC_EXPORT_API void | qsc_x509w_trust_store_clear (qsc_x509w_trust_store *store) |
| Clear a wrapper trust store and release its stored material. | |
| QSC_EXPORT_API void | qsc_x509w_server_identity_initialize (qsc_x509w_server_identity *identity) |
| Initialize a server identity object. | |
| QSC_EXPORT_API void | qsc_x509w_server_identity_clear (qsc_x509w_server_identity *identity) |
| Clear a server identity and release its stored material. | |
| QSC_EXPORT_API void | qsc_x509w_deployment_config_initialize (qsc_x509w_deployment_config *config) |
| Initialize a deployment configuration object. | |
| QSC_EXPORT_API void | qsc_x509w_tls_bridge_initialize (qsc_x509w_tls_bridge *bridge) |
| Initialize a TLS bridge object. | |
| QSC_EXPORT_API void | qsc_x509w_tls_local_certificate_initialize (qsc_x509w_tls_local_certificate *localcert) |
| Initialize a TLS local-certificate export object. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_current_utc_time (qsc_x509_time *currenttime) |
| Acquire the current UTC time in X.509 time form. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_load_file (const char *path, qsc_x509_certificate *certificate) |
| Load a certificate from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_load_memory (const uint8_t *data, size_t datalen, qsc_x509_certificate *certificate) |
| Load a certificate from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_chain_load_file (const char *path, qsc_x509_certificate *certificates, size_t certificatecount, qsc_x509_chain *chain) |
| Load a certificate chain from a file into caller-supplied certificate storage and a chain descriptor. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_chain_load_memory (const uint8_t *data, size_t datalen, qsc_x509_certificate *certificates, size_t certificatecount, qsc_x509_chain *chain) |
| Load a certificate chain from a memory buffer into caller-supplied certificate storage and a chain descriptor. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_private_key_load_file (const char *path, qsc_x509_private_key *privatekey) |
| Load a private key from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_private_key_load_memory (const uint8_t *data, size_t datalen, qsc_x509_private_key *privatekey) |
| Load a private key from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_crl_load_file (const char *path, qsc_x509_crl *crl) |
| Load a CRL from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_crl_load_memory (const uint8_t *data, size_t datalen, qsc_x509_crl *crl) |
| Load a CRL from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_load_file (const char *path, qsc_x509_csr *csr) |
| Load a CSR from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_load_memory (const uint8_t *data, size_t datalen, qsc_x509_csr *csr) |
| Load a CSR from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_anchor (qsc_x509w_trust_store *store, const qsc_x509_certificate *certificate, bool selfsigned) |
| Add a certificate to the trust store as an anchor. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_anchor_bundle_memory (qsc_x509w_trust_store *store, const uint8_t *data, size_t datalen, bool selfsigned) |
| Decode and add one or more trust anchors from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_anchor_bundle_file (qsc_x509w_trust_store *store, const char *path, bool selfsigned) |
| Decode and add one or more trust anchors from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_anchor_file (qsc_x509w_trust_store *store, const char *path, bool selfsigned) |
| Load and add a single trust anchor from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_anchor_memory (qsc_x509w_trust_store *store, const uint8_t *data, size_t datalen, bool selfsigned) |
| Load and add a single trust anchor from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_crl (qsc_x509w_trust_store *store, const qsc_x509_crl *crl) |
| Add a decoded CRL to the trust store. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_crl_file (qsc_x509w_trust_store *store, const char *path) |
| Load and add a CRL from a file. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_add_crl_memory (qsc_x509w_trust_store *store, const uint8_t *data, size_t datalen) |
| Load and add a CRL from a memory buffer. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_server_identity_load_files (qsc_x509w_server_identity *identity, const char *certificatechainpath, const char *privatekeypath) |
| Load a server identity from certificate-chain and private-key files. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_server_identity_load_configuration (qsc_x509w_server_identity *identity, const qsc_x509w_deployment_config *config, qsc_x509w_result *result) |
| Load a server identity using a deployment configuration. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_trust_store_load_configuration (qsc_x509w_trust_store *store, const qsc_x509w_deployment_config *config, qsc_x509w_result *result) |
| Load trust material using a deployment configuration. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_server_identity_get_chain (const qsc_x509w_server_identity *identity, qsc_x509_chain *chain) |
| Build a chain descriptor from a loaded server identity. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_server_identity_validate (const qsc_x509w_server_identity *identity, const qsc_x509w_profile *profile, qsc_x509w_result *result) |
| Validate a loaded server identity against a wrapper profile. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_server_identity_verify (const qsc_x509w_server_identity *identity, const qsc_x509w_trust_store *store, const qsc_x509w_profile *profile, qsc_x509w_result *result) |
| Verify a loaded server identity against a trust store and profile. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_check_role (const qsc_x509_certificate *certificate, qsc_x509w_certificate_role role, const char *hostname, qsc_x509w_result *result) |
| Evaluate whether a certificate is suitable for a requested role. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_verify_peer_certificates (const qsc_x509_certificate *certificates, size_t certificatecount, const qsc_x509w_trust_store *store, const qsc_x509w_profile *profile, qsc_x509w_result *result) |
| Verify a peer certificate chain against a trust store and wrapper profile. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_name_string (const qsc_x509_name *name, char *output, size_t outputlen, size_t *written) |
| Format a distinguished name into a normalized string. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_name_get_attribute_first (const qsc_x509_name *name, qsc_x509_name_attribute_type type, char *output, size_t outputlen, size_t *written) |
| Extract the first matching attribute value from a distinguished name. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_subject_string (const qsc_x509_certificate *certificate, char *output, size_t outputlen, size_t *written) |
| Format a certificate subject distinguished name into a normalized string. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_issuer_string (const qsc_x509_certificate *certificate, char *output, size_t outputlen, size_t *written) |
| Format a certificate issuer distinguished name into a normalized string. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_subject_common_name (const qsc_x509_certificate *certificate, char *output, size_t outputlen, size_t *written) |
| Extract the first common-name attribute from a certificate subject. | |
| QSC_EXPORT_API size_t | qsc_x509w_certificate_subject_dns_name_count (const qsc_x509_certificate *certificate) |
| Get the number of DNS subjectAltName entries in a certificate. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_subject_dns_name (const qsc_x509_certificate *certificate, size_t index, char *output, size_t outputlen, size_t *written) |
| Retrieve a DNS subjectAltName entry by index. | |
| QSC_EXPORT_API const char * | qsc_x509w_revocation_mode_string (qsc_x509w_revocation_mode mode) |
| Convert a revocation mode to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_locator_policy_string (qsc_x509w_locator_policy policy) |
| Convert a locator policy to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_revocation_source_string (qsc_x509w_revocation_source source) |
| Convert a revocation source to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_availability_string (qsc_x509w_availability availability) |
| Convert an availability indicator to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_status_string (qsc_x509w_status status) |
| Convert a wrapper status code to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_stage_string (qsc_x509w_stage stage) |
| Convert a wrapper stage identifier to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_verify_status_string (qsc_x509_verify_status status) |
| Convert an underlying verification status to a constant display string. | |
| QSC_EXPORT_API const char * | qsc_x509w_result_message (const qsc_x509w_result *result) |
| Get the current diagnostic message stored in a wrapper result. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_export_der (const qsc_x509_certificate *certificate, uint8_t *output, size_t outputlen, size_t *written) |
| Export a certificate as DER. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_export_pem (const qsc_x509_certificate *certificate, char *output, size_t outputlen, size_t *written) |
| Export a certificate as PEM. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_private_key_export_pkcs8_der (const qsc_x509_private_key *privatekey, bool includepublickey, uint8_t *output, size_t outputlen, size_t *written) |
| Export a private key as PKCS#8 DER. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_private_key_export_pkcs8_pem (const qsc_x509_private_key *privatekey, bool includepublickey, char *output, size_t outputlen, size_t *written) |
| Export a private key as PKCS#8 PEM. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_export_der (const qsc_x509_csr *csr, uint8_t *output, size_t outputlen, size_t *written) |
| Export a CSR as DER. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_export_pem (const qsc_x509_csr *csr, char *output, size_t outputlen, size_t *written) |
| Export a CSR as PEM. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_create (qsc_x509_csr *csr, const qsc_x509_name *subject, const qsc_x509_subject_public_key_info *spki, const qsc_x509_algorithm_identifier *signaturealgorithm) |
| Initialize a CSR for later signing. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_add_dns_name (qsc_x509_csr *csr, const char *dnsname) |
| Add a DNS subjectAltName entry to a CSR. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_sign_der (const qsc_x509_csr *csr, qsc_x509_certificate_sign_callback signcallback, void *context, uint8_t *output, size_t *outputlen) |
| Sign a CSR and export the result as DER. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_sign_pem (const qsc_x509_csr *csr, qsc_x509_certificate_sign_callback signcallback, void *context, char *output, size_t *outputlen) |
| Sign a CSR and export the result as PEM. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_csr_verify (const qsc_x509_csr *csr) |
| Verify a CSR signature and structure. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_certificate_issue_from_csr (const qsc_x509_csr *csr, const qsc_x509_certificate *issuer, const qsc_x509_algorithm_identifier *signaturealgorithm, const uint8_t *serialnumber, size_t serialnumberlen, const qsc_x509_validity *validity, uint32_t profile, uint32_t policyflags, qsc_x509_certificate_sign_callback signcallback, void *context, uint8_t *output, size_t *outputlen) |
| Issue a certificate from a CSR and export the result as DER. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_tls_bridge_configure (qsc_x509w_tls_bridge *bridge, const qsc_x509w_trust_store *store, const qsc_x509w_profile *profile) |
| Configure a TLS bridge with a trust store and validation profile. | |
| QSC_EXPORT_API bool | qsc_x509w_tls_bridge_is_ready (const qsc_x509w_tls_bridge *bridge) |
| Determine whether a TLS bridge has been configured and is ready for use. | |
| QSC_EXPORT_API const qsc_tls_certificate_interface * | qsc_x509w_tls_bridge_get_interface (const qsc_x509w_tls_bridge *bridge) |
| Get the prepared TLS certificate interface from a configured bridge. | |
| QSC_EXPORT_API bool | qsc_x509w_tls_local_certificate_is_ready (const qsc_x509w_tls_local_certificate *localcert) |
| Determine whether a TLS local-certificate export object is ready for use. | |
| QSC_EXPORT_API qsc_x509w_status | qsc_x509w_tls_local_certificate_from_identity (const qsc_x509w_server_identity *identity, qsc_tls_signature_scheme verifyscheme, qsc_x509w_tls_local_certificate *localcert) |
| Export a server identity into TLS local-certificate form. | |
High-level offline X.509 wrapper for certificate loading, validation, deployment configuration, trust-store management, provisioning, and TLS bridge integration.
This header defines the public wrapper layer over the QSC X.509 implementation. The wrapper is intended to simplify the most common operational uses of X.509 while preserving strict control over ownership, validation policy, diagnostics, and TLS integration boundaries.
The wrapper is offline-only. Public APIs declared in this header do not perform network I/O, dereference remote URIs, fetch issuer certificates, retrieve CRLs, or issue OCSP requests. Any future network-assisted certificate retrieval is expected to reside in a separate companion layer.
Availability reporting for optional policy-driven materials.
Common certificate roles evaluated by wrapper suitability checks.
Policy for future embedded locator handling such as AIA and OCSP URIs.
Predefined validation-profile configurations for common workflows.
Revocation policy requested by a validation profile.
| enum qsc_x509w_stage_t |
High-level operational stage indicators recorded in wrapper results.
| enum qsc_x509w_status_t |
Wrapper-level status codes returned by x509wrap operations.
| QSC_EXPORT_API const char * qsc_x509w_availability_string | ( | qsc_x509w_availability | availability | ) |
Convert an availability indicator to a constant display string.
| availability | The availability indicator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_chain_load_file | ( | const char * | path, |
| qsc_x509_certificate * | certificates, | ||
| size_t | certificatecount, | ||
| qsc_x509_chain * | chain ) |
Load a certificate chain from a file into caller-supplied certificate storage and a chain descriptor.
| path | The input file path. |
| certificates | The caller-supplied certificate storage array. |
| certificatecount | The capacity of the certificate storage array. |
| chain | The destination chain descriptor. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_chain_load_memory | ( | const uint8_t * | data, |
| size_t | datalen, | ||
| qsc_x509_certificate * | certificates, | ||
| size_t | certificatecount, | ||
| qsc_x509_chain * | chain ) |
Load a certificate chain from a memory buffer into caller-supplied certificate storage and a chain descriptor.
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| certificates | The caller-supplied certificate storage array. |
| certificatecount | The capacity of the certificate storage array. |
| chain | The destination chain descriptor. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_check_role | ( | const qsc_x509_certificate * | certificate, |
| qsc_x509w_certificate_role | role, | ||
| const char * | hostname, | ||
| qsc_x509w_result * | result ) |
Evaluate whether a certificate is suitable for a requested role.
| certificate | The certificate to test. |
| role | The requested certificate role. |
| hostname | An optional hostname used for TLS server role evaluation. |
| result | The destination diagnostic result object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_export_der | ( | const qsc_x509_certificate * | certificate, |
| uint8_t * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Export a certificate as DER.
| certificate | The certificate to export. |
| output | The destination byte buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_export_pem | ( | const qsc_x509_certificate * | certificate, |
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Export a certificate as PEM.
| certificate | The certificate to export. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_issue_from_csr | ( | const qsc_x509_csr * | csr, |
| const qsc_x509_certificate * | issuer, | ||
| const qsc_x509_algorithm_identifier * | signaturealgorithm, | ||
| const uint8_t * | serialnumber, | ||
| size_t | serialnumberlen, | ||
| const qsc_x509_validity * | validity, | ||
| uint32_t | profile, | ||
| uint32_t | policyflags, | ||
| qsc_x509_certificate_sign_callback | signcallback, | ||
| void * | context, | ||
| uint8_t * | output, | ||
| size_t * | outputlen ) |
Issue a certificate from a CSR and export the result as DER.
| csr | The source CSR. |
| issuer | The issuer certificate. |
| signaturealgorithm | The signature algorithm identifier to encode. |
| serialnumber | The certificate serial number buffer. |
| serialnumberlen | The length of the serial-number buffer in bytes. |
| validity | The certificate validity period. |
| profile | The issuer-profile flags passed through to the certificate builder. |
| policyflags | Additional issuance policy flags passed through to the certificate builder. |
| signcallback | The issuer signing callback. |
| context | The opaque callback context. |
| output | The destination DER buffer. |
| outputlen | On input, the output-buffer capacity; on output, the number of bytes written. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_issuer_string | ( | const qsc_x509_certificate * | certificate, |
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Format a certificate issuer distinguished name into a normalized string.
| certificate | The source certificate. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_load_file | ( | const char * | path, |
| qsc_x509_certificate * | certificate ) |
Load a certificate from a file.
| path | The input file path. |
| certificate | The destination certificate object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_load_memory | ( | const uint8_t * | data, |
| size_t | datalen, | ||
| qsc_x509_certificate * | certificate ) |
Load a certificate from a memory buffer.
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| certificate | The destination certificate object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_subject_common_name | ( | const qsc_x509_certificate * | certificate, |
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Extract the first common-name attribute from a certificate subject.
| certificate | The source certificate. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_subject_dns_name | ( | const qsc_x509_certificate * | certificate, |
| size_t | index, | ||
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Retrieve a DNS subjectAltName entry by index.
| certificate | The source certificate. |
| index | The zero-based DNS name index. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API size_t qsc_x509w_certificate_subject_dns_name_count | ( | const qsc_x509_certificate * | certificate | ) |
Get the number of DNS subjectAltName entries in a certificate.
| certificate | The source certificate. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_certificate_subject_string | ( | const qsc_x509_certificate * | certificate, |
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Format a certificate subject distinguished name into a normalized string.
| certificate | The source certificate. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_crl_load_file | ( | const char * | path, |
| qsc_x509_crl * | crl ) |
Load a CRL from a file.
| path | The input file path. |
| crl | The destination CRL object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_crl_load_memory | ( | const uint8_t * | data, |
| size_t | datalen, | ||
| qsc_x509_crl * | crl ) |
Load a CRL from a memory buffer.
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| crl | The destination CRL object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_add_dns_name | ( | qsc_x509_csr * | csr, |
| const char * | dnsname ) |
Add a DNS subjectAltName entry to a CSR.
| csr | The CSR to modify. |
| dnsname | The DNS name to add. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_create | ( | qsc_x509_csr * | csr, |
| const qsc_x509_name * | subject, | ||
| const qsc_x509_subject_public_key_info * | spki, | ||
| const qsc_x509_algorithm_identifier * | signaturealgorithm ) |
Initialize a CSR for later signing.
| csr | The CSR object to initialize. |
| subject | The CSR subject name. |
| spki | The subject public-key information. |
| signaturealgorithm | The requested CSR signature algorithm identifier. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_export_der | ( | const qsc_x509_csr * | csr, |
| uint8_t * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Export a CSR as DER.
| csr | The CSR to export. |
| output | The destination byte buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_export_pem | ( | const qsc_x509_csr * | csr, |
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Export a CSR as PEM.
| csr | The CSR to export. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_load_file | ( | const char * | path, |
| qsc_x509_csr * | csr ) |
Load a CSR from a file.
| path | The input file path. |
| csr | The destination CSR object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_load_memory | ( | const uint8_t * | data, |
| size_t | datalen, | ||
| qsc_x509_csr * | csr ) |
Load a CSR from a memory buffer.
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| csr | The destination CSR object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_sign_der | ( | const qsc_x509_csr * | csr, |
| qsc_x509_certificate_sign_callback | signcallback, | ||
| void * | context, | ||
| uint8_t * | output, | ||
| size_t * | outputlen ) |
Sign a CSR and export the result as DER.
| csr | The CSR to sign. |
| signcallback | The caller-supplied signing callback. |
| context | The opaque callback context. |
| output | The destination DER buffer. |
| outputlen | On input, the output-buffer capacity; on output, the number of bytes written. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_sign_pem | ( | const qsc_x509_csr * | csr, |
| qsc_x509_certificate_sign_callback | signcallback, | ||
| void * | context, | ||
| char * | output, | ||
| size_t * | outputlen ) |
Sign a CSR and export the result as PEM.
| csr | The CSR to sign. |
| signcallback | The caller-supplied signing callback. |
| context | The opaque callback context. |
| output | The destination PEM buffer. |
| outputlen | On input, the output-buffer capacity; on output, the number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_csr_verify | ( | const qsc_x509_csr * | csr | ) |
Verify a CSR signature and structure.
| csr | The CSR to verify. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_current_utc_time | ( | qsc_x509_time * | currenttime | ) |
Acquire the current UTC time in X.509 time form.
| currenttime | The destination time object. |
| QSC_EXPORT_API void qsc_x509w_deployment_config_initialize | ( | qsc_x509w_deployment_config * | config | ) |
Initialize a deployment configuration object.
| config | The configuration object to initialize. |
| QSC_EXPORT_API const char * qsc_x509w_locator_policy_string | ( | qsc_x509w_locator_policy | policy | ) |
Convert a locator policy to a constant display string.
| policy | The locator policy. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_name_get_attribute_first | ( | const qsc_x509_name * | name, |
| qsc_x509_name_attribute_type | type, | ||
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Extract the first matching attribute value from a distinguished name.
| name | The name to search. |
| type | The requested attribute type. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_name_string | ( | const qsc_x509_name * | name, |
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Format a distinguished name into a normalized string.
| name | The name to format. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_private_key_export_pkcs8_der | ( | const qsc_x509_private_key * | privatekey, |
| bool | includepublickey, | ||
| uint8_t * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Export a private key as PKCS#8 DER.
| privatekey | The private key to export. |
| includepublickey | Set true to include public-key data when supported. |
| output | The destination byte buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_private_key_export_pkcs8_pem | ( | const qsc_x509_private_key * | privatekey, |
| bool | includepublickey, | ||
| char * | output, | ||
| size_t | outputlen, | ||
| size_t * | written ) |
Export a private key as PKCS#8 PEM.
| privatekey | The private key to export. |
| includepublickey | Set true to include public-key data when supported. |
| output | The destination character buffer. |
| outputlen | The capacity of the destination buffer in bytes. |
| written | The optional number of bytes written excluding the terminator. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_private_key_load_file | ( | const char * | path, |
| qsc_x509_private_key * | privatekey ) |
Load a private key from a file.
| path | The input file path. |
| privatekey | The destination private-key object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_private_key_load_memory | ( | const uint8_t * | data, |
| size_t | datalen, | ||
| qsc_x509_private_key * | privatekey ) |
Load a private key from a memory buffer.
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| privatekey | The destination private-key object. |
| QSC_EXPORT_API void qsc_x509w_profile_apply_preset | ( | qsc_x509w_profile * | profile, |
| qsc_x509w_profile_preset | preset ) |
Apply a predefined validation-profile preset.
| profile | The profile to update. |
| preset | The preset to apply. |
| QSC_EXPORT_API void qsc_x509w_profile_initialize | ( | qsc_x509w_profile * | profile | ) |
Initialize a validation profile to wrapper defaults.
| profile | The profile to initialize. |
| QSC_EXPORT_API void qsc_x509w_profile_set_ca_defaults | ( | qsc_x509w_profile * | profile | ) |
Set CA-validation defaults in a profile.
| profile | The profile to update. |
| QSC_EXPORT_API void qsc_x509w_profile_set_development_defaults | ( | qsc_x509w_profile * | profile | ) |
Set relaxed development defaults in a profile.
| profile | The profile to update. |
| QSC_EXPORT_API void qsc_x509w_profile_set_strict_revocation_defaults | ( | qsc_x509w_profile * | profile | ) |
Set strict revocation defaults in a profile.
| profile | The profile to update. |
| QSC_EXPORT_API void qsc_x509w_profile_set_tls_client_defaults | ( | qsc_x509w_profile * | profile | ) |
Set TLS client validation defaults in a profile.
| profile | The profile to update. |
| QSC_EXPORT_API void qsc_x509w_profile_set_tls_server_defaults | ( | qsc_x509w_profile * | profile | ) |
Set TLS server validation defaults in a profile.
| profile | The profile to update. |
| QSC_EXPORT_API void qsc_x509w_result_initialize | ( | qsc_x509w_result * | result | ) |
Initialize a wrapper result object to its default state.
| result | The result object to initialize. |
| QSC_EXPORT_API const char * qsc_x509w_result_message | ( | const qsc_x509w_result * | result | ) |
Get the current diagnostic message stored in a wrapper result.
| result | The source result object. |
| QSC_EXPORT_API const char * qsc_x509w_revocation_mode_string | ( | qsc_x509w_revocation_mode | mode | ) |
Convert a revocation mode to a constant display string.
| mode | The revocation mode. |
| QSC_EXPORT_API const char * qsc_x509w_revocation_source_string | ( | qsc_x509w_revocation_source | source | ) |
Convert a revocation source to a constant display string.
| source | The revocation source. |
| QSC_EXPORT_API void qsc_x509w_server_identity_clear | ( | qsc_x509w_server_identity * | identity | ) |
Clear a server identity and release its stored material.
| identity | The server identity to clear. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_server_identity_get_chain | ( | const qsc_x509w_server_identity * | identity, |
| qsc_x509_chain * | chain ) |
Build a chain descriptor from a loaded server identity.
| identity | The source server identity. |
| chain | The destination chain descriptor. |
| QSC_EXPORT_API void qsc_x509w_server_identity_initialize | ( | qsc_x509w_server_identity * | identity | ) |
Initialize a server identity object.
| identity | The server identity to initialize. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_server_identity_load_configuration | ( | qsc_x509w_server_identity * | identity, |
| const qsc_x509w_deployment_config * | config, | ||
| qsc_x509w_result * | result ) |
Load a server identity using a deployment configuration.
| identity | The destination server identity. |
| config | The deployment configuration. |
| result | The optional diagnostic result object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_server_identity_load_files | ( | qsc_x509w_server_identity * | identity, |
| const char * | certificatechainpath, | ||
| const char * | privatekeypath ) |
Load a server identity from certificate-chain and private-key files.
| identity | The destination server identity. |
| certificatechainpath | The path to the certificate chain file. |
| privatekeypath | The path to the private-key file. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_server_identity_validate | ( | const qsc_x509w_server_identity * | identity, |
| const qsc_x509w_profile * | profile, | ||
| qsc_x509w_result * | result ) |
Validate a loaded server identity against a wrapper profile.
| identity | The server identity to validate. |
| profile | The validation profile. |
| result | The destination diagnostic result object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_server_identity_verify | ( | const qsc_x509w_server_identity * | identity, |
| const qsc_x509w_trust_store * | store, | ||
| const qsc_x509w_profile * | profile, | ||
| qsc_x509w_result * | result ) |
Verify a loaded server identity against a trust store and profile.
| identity | The server identity to verify. |
| store | The trust store supplying anchors and CRLs. |
| profile | The validation profile. |
| result | The destination diagnostic result object. |
| QSC_EXPORT_API const char * qsc_x509w_stage_string | ( | qsc_x509w_stage | stage | ) |
Convert a wrapper stage identifier to a constant display string.
| stage | The wrapper stage identifier. |
| QSC_EXPORT_API const char * qsc_x509w_status_string | ( | qsc_x509w_status | status | ) |
Convert a wrapper status code to a constant display string.
| status | The wrapper status code. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_tls_bridge_configure | ( | qsc_x509w_tls_bridge * | bridge, |
| const qsc_x509w_trust_store * | store, | ||
| const qsc_x509w_profile * | profile ) |
Configure a TLS bridge with a trust store and validation profile.
| bridge | The bridge to configure. |
| store | The trust store that must outlive the bridge. |
| profile | The validation profile to copy into the bridge. |
| QSC_EXPORT_API const qsc_tls_certificate_interface * qsc_x509w_tls_bridge_get_interface | ( | const qsc_x509w_tls_bridge * | bridge | ) |
Get the prepared TLS certificate interface from a configured bridge.
The returned interface is a borrowed view into bridge. TLS client and server configuration objects should copy this interface using TLS-layer configuration setters. The X.509 wrapper intentionally does not mutate TLS client or server state objects, preserving the dependency boundary between certificate handling and the TLS state machines.
| bridge | The configured bridge. |
| QSC_EXPORT_API void qsc_x509w_tls_bridge_initialize | ( | qsc_x509w_tls_bridge * | bridge | ) |
Initialize a TLS bridge object.
| bridge | The bridge object to initialize. |
| QSC_EXPORT_API bool qsc_x509w_tls_bridge_is_ready | ( | const qsc_x509w_tls_bridge * | bridge | ) |
Determine whether a TLS bridge has been configured and is ready for use.
| bridge | The bridge to test. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_tls_local_certificate_from_identity | ( | const qsc_x509w_server_identity * | identity, |
| qsc_tls_signature_scheme | verifyscheme, | ||
| qsc_x509w_tls_local_certificate * | localcert ) |
Export a server identity into TLS local-certificate form.
Extracts the certificate chain and private key from the identity object and populates a qsc_x509w_tls_local_certificate ready for use by the TLS-layer server configuration local-certificate setter.
| identity | The source server identity (must contain a valid private key). |
| verifyscheme | The TLS CertificateVerify signature scheme identifier. |
| localcert | The destination TLS local-certificate export object. |
| QSC_EXPORT_API void qsc_x509w_tls_local_certificate_initialize | ( | qsc_x509w_tls_local_certificate * | localcert | ) |
Initialize a TLS local-certificate export object.
| localcert | The local certificate container to initialize. |
| QSC_EXPORT_API bool qsc_x509w_tls_local_certificate_is_ready | ( | const qsc_x509w_tls_local_certificate * | localcert | ) |
Determine whether a TLS local-certificate export object is ready for use.
| localcert | The local-certificate export object to test. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_anchor | ( | qsc_x509w_trust_store * | store, |
| const qsc_x509_certificate * | certificate, | ||
| bool | selfsigned ) |
Add a certificate to the trust store as an anchor.
| store | The destination trust store. |
| certificate | The certificate to add. |
| selfsigned | Set true when the anchor is expected to be self-signed. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_anchor_bundle_file | ( | qsc_x509w_trust_store * | store, |
| const char * | path, | ||
| bool | selfsigned ) |
Decode and add one or more trust anchors from a file.
| store | The destination trust store. |
| path | The input file path. |
| selfsigned | Set true when the loaded anchors are expected to be self-signed. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_anchor_bundle_memory | ( | qsc_x509w_trust_store * | store, |
| const uint8_t * | data, | ||
| size_t | datalen, | ||
| bool | selfsigned ) |
Decode and add one or more trust anchors from a memory buffer.
| store | The destination trust store. |
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| selfsigned | Set true when the loaded anchors are expected to be self-signed. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_anchor_file | ( | qsc_x509w_trust_store * | store, |
| const char * | path, | ||
| bool | selfsigned ) |
Load and add a single trust anchor from a file.
| store | The destination trust store. |
| path | The input file path. |
| selfsigned | Set true when the loaded anchor is expected to be self-signed. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_anchor_memory | ( | qsc_x509w_trust_store * | store, |
| const uint8_t * | data, | ||
| size_t | datalen, | ||
| bool | selfsigned ) |
Load and add a single trust anchor from a memory buffer.
| store | The destination trust store. |
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| selfsigned | Set true when the loaded anchor is expected to be self-signed. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_crl | ( | qsc_x509w_trust_store * | store, |
| const qsc_x509_crl * | crl ) |
Add a decoded CRL to the trust store.
| store | The destination trust store. |
| crl | The CRL to add. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_crl_file | ( | qsc_x509w_trust_store * | store, |
| const char * | path ) |
Load and add a CRL from a file.
| store | The destination trust store. |
| path | The input file path. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_add_crl_memory | ( | qsc_x509w_trust_store * | store, |
| const uint8_t * | data, | ||
| size_t | datalen ) |
Load and add a CRL from a memory buffer.
| store | The destination trust store. |
| data | The input buffer. |
| datalen | The length of the input buffer in bytes. |
| QSC_EXPORT_API void qsc_x509w_trust_store_clear | ( | qsc_x509w_trust_store * | store | ) |
Clear a wrapper trust store and release its stored material.
| store | The trust store to clear. |
| QSC_EXPORT_API void qsc_x509w_trust_store_initialize | ( | qsc_x509w_trust_store * | store | ) |
Initialize a wrapper trust store.
| store | The trust store to initialize. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_trust_store_load_configuration | ( | qsc_x509w_trust_store * | store, |
| const qsc_x509w_deployment_config * | config, | ||
| qsc_x509w_result * | result ) |
Load trust material using a deployment configuration.
| store | The destination trust store. |
| config | The deployment configuration. |
| result | The optional diagnostic result object. |
| QSC_EXPORT_API qsc_x509w_status qsc_x509w_verify_peer_certificates | ( | const qsc_x509_certificate * | certificates, |
| size_t | certificatecount, | ||
| const qsc_x509w_trust_store * | store, | ||
| const qsc_x509w_profile * | profile, | ||
| qsc_x509w_result * | result ) |
Verify a peer certificate chain against a trust store and wrapper profile.
| certificates | The certificate chain array in peer-presented order. |
| certificatecount | The number of certificates in the array. |
| store | The trust store supplying anchors and CRLs. |
| profile | The validation profile. |
| result | The destination diagnostic result object. |
| QSC_EXPORT_API const char * qsc_x509w_verify_status_string | ( | qsc_x509_verify_status | status | ) |
Convert an underlying verification status to a constant display string.
| status | The underlying verification status. |