QSC Post Quantum Cryptographic Library 1.1.0.2 (B2)
A post quantum secure library written in Ansi C
Loading...
Searching...
No Matches
x509crl.h
Go to the documentation of this file.
1/* 2020-2026 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE:
5 * This software and all accompanying materials are the exclusive property of
6 * Quantum Resistant Cryptographic Solutions Corporation (QRCS). The intellectual
7 * and technical concepts contained herein are proprietary to QRCS and are
8 * protected under applicable Canadian, U.S., and international copyright,
9 * patent, and trade secret laws.
10 *
11 * CRYPTOGRAPHIC ALGORITHMS AND IMPLEMENTATIONS:
12 * - This software includes implementations of cryptographic primitives and
13 * algorithms that are standardized or in the public domain, such as AES
14 * and SHA-3, which are not proprietary to QRCS.
15 * - This software also includes cryptographic primitives, constructions, and
16 * algorithms designed by QRCS, including but not limited to RCS, SCB, CSX, QMAC, and
17 * related components, which are proprietary to QRCS.
18 * - All source code, implementations, protocol compositions, optimizations,
19 * parameter selections, and engineering work contained in this software are
20 * original works of QRCS and are protected under this license.
21 *
22 * LICENSE AND USE RESTRICTIONS:
23 * - This software is licensed under the Quantum Resistant Cryptographic Solutions
24 * Public Research and Evaluation License (QRCS-PREL), 2025-2026.
25 * - Permission is granted solely for non-commercial evaluation, academic research,
26 * cryptographic analysis, interoperability testing, and feasibility assessment.
27 * - Commercial use, production deployment, commercial redistribution, or
28 * integration into products or services is strictly prohibited without a
29 * separate written license agreement executed with QRCS.
30 * - Licensing and authorized distribution are solely at the discretion of QRCS.
31 *
32 * EXPERIMENTAL CRYPTOGRAPHY NOTICE:
33 * Portions of this software may include experimental, novel, or evolving
34 * cryptographic designs. Use of this software is entirely at the user's risk.
35 *
36 * DISCLAIMER:
37 * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38 * IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS
39 * FOR A PARTICULAR PURPOSE, SECURITY, OR NON-INFRINGEMENT. QRCS DISCLAIMS ALL
40 * LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
41 * ARISING FROM THE USE OR MISUSE OF THIS SOFTWARE.
42 *
43 * FULL LICENSE:
44 * This software is subject to the Quantum Resistant Cryptographic Solutions
45 * Public Research and Evaluation License (QRCS-PREL), 2025-2026. The complete license terms
46 * are provided in the accompanying LICENSE file or at https://www.qrcscorp.ca.
47 *
48 * Written by: John G. Underhill
49 * Contact: contact@qrcscorp.ca
50 */
51
52#ifndef QSC_X509_CRL_H
53#define QSC_X509_CRL_H
54
55#include "qsccommon.h"
56#include "x509types.h"
57
58QSC_CPLUSPLUS_ENABLED_START
59
79
84#define QSC_X509_CRL_ENTRY_MAX 512U
85
96#define QSC_X509_CRL_REVOKED_MAX 1024U
97
108{
109 uint8_t serialnumber[QSC_X509_SERIAL_NUMBER_MAX];
115
126typedef struct qsc_x509_crl_t
127{
128 uint32_t version;
129 qsc_x509_algorithm_identifier tbsignature;
130 qsc_x509_name issuer;
134 qsc_x509_crl_entry revoked[QSC_X509_CRL_REVOKED_MAX];
136 qsc_x509_extensions extensions;
137 qsc_x509_algorithm_identifier signaturealgorithm;
138 uint8_t signature[QSC_X509_SIGNATURE_MAX];
141 const uint8_t* tbsdata;
142 size_t tbsdatalen;
143 const uint8_t* der;
144 size_t derlen;
146
171
188typedef bool (*qsc_x509_crl_signature_verify_callback)(const qsc_x509_crl* crl, const qsc_x509_certificate* issuer, void* state);
189
202
217QSC_EXPORT_API qsc_asn1_status qsc_x509_crl_decode_der(const uint8_t* der, size_t derlen, qsc_x509_crl* crl);
218
233QSC_EXPORT_API qsc_asn1_status qsc_x509_crl_encode_der(const qsc_x509_crl* crl, uint8_t* output, size_t* outputlen);
234
248
260QSC_EXPORT_API qsc_x509_crl_verify_status qsc_x509_crl_check_algorithms(const qsc_x509_crl* crl);
261
275QSC_EXPORT_API const qsc_x509_crl_entry* qsc_x509_crl_find_serial(const qsc_x509_crl* crl, const uint8_t* serial, size_t seriallen);
276
290QSC_EXPORT_API bool qsc_x509_certificate_is_revoked_by_crl(const qsc_x509_certificate* certificate, const qsc_x509_crl* crl);
291
305QSC_EXPORT_API bool qsc_x509_crl_is_revoked(const qsc_x509_crl* crl, const qsc_x509_certificate* certificate);
306
323QSC_EXPORT_API qsc_x509_crl_verify_status qsc_x509_crl_verify(const qsc_x509_crl* crl, const qsc_x509_certificate* issuer, const qsc_asn1_time* now, qsc_x509_crl_signature_verify_callback callback, void* state);
324
325QSC_CPLUSPLUS_ENABLED_END
326
327#endif
enum qsc_asn1_status_t qsc_asn1_status
ASN.1 helper status codes.
QSC_EXPORT_API struct qsc_asn1_time_t qsc_asn1_time
A normalized ASN.1 time representation.
Contains common definitions for the Quantum Secure Cryptographic (QSC) library.
#define QSC_EXPORT_API
API export macro for Microsoft compilers when importing from a DLL.
Definition qsccommon.h:605
Definition x509crl.h:108
size_t serialnumberlen
Definition x509crl.h:110
qsc_asn1_time revocationdate
Definition x509crl.h:111
uint8_t rawextensions[QSC_X509_CRL_ENTRY_MAX]
Definition x509crl.h:112
size_t rawextensionslen
Definition x509crl.h:113
A decoded revoked-certificate entry from a CRL.
Definition x509crl.h:127
qsc_asn1_time nextupdate
Definition x509crl.h:133
bool nextupdate_present
Definition x509crl.h:132
const uint8_t * tbsdata
Definition x509crl.h:141
uint8_t signature[QSC_X509_SIGNATURE_MAX]
Definition x509crl.h:138
size_t signaturelen
Definition x509crl.h:139
size_t tbsdatalen
Definition x509crl.h:142
qsc_x509_name issuer
Definition x509crl.h:130
size_t derlen
Definition x509crl.h:144
qsc_x509_algorithm_identifier signaturealgorithm
Definition x509crl.h:137
qsc_x509_extensions extensions
Definition x509crl.h:136
qsc_x509_algorithm_identifier tbsignature
Definition x509crl.h:129
const uint8_t * der
Definition x509crl.h:143
qsc_x509_crl_entry revoked[QSC_X509_CRL_REVOKED_MAX]
Definition x509crl.h:134
uint8_t signatureunusedbits
Definition x509crl.h:140
qsc_asn1_time thisupdate
Definition x509crl.h:131
size_t revokedcount
Definition x509crl.h:135
A decoded X.509 CertificateList object.
#define QSC_X509_CRL_ENTRY_MAX
Maximum encoded size, in bytes, of a single CRL revoked-certificate entry.
Definition x509crl.h:84
QSC_EXPORT_API bool qsc_x509_crl_is_current(const qsc_x509_crl *crl, const qsc_asn1_time *now)
Test whether a CRL is current at a supplied evaluation time.
Definition x509crl.c:592
QSC_EXPORT_API qsc_asn1_status qsc_x509_crl_encode_der(const qsc_x509_crl *crl, uint8_t *output, size_t *outputlen)
Encode a decoded CRL object as DER.
Definition x509crl.c:398
QSC_EXPORT_API bool qsc_x509_certificate_is_revoked_by_crl(const qsc_x509_certificate *certificate, const qsc_x509_crl *crl)
Test whether a certificate is revoked by a CRL.
Definition x509crl.c:672
QSC_EXPORT_API const qsc_x509_crl_entry * qsc_x509_crl_find_serial(const qsc_x509_crl *crl, const uint8_t *serial, size_t seriallen)
Find a revoked entry by certificate serial number.
Definition x509crl.c:647
QSC_EXPORT_API qsc_x509_crl_verify_status qsc_x509_crl_verify(const qsc_x509_crl *crl, const qsc_x509_certificate *issuer, const qsc_asn1_time *now, qsc_x509_crl_signature_verify_callback callback, void *state)
Verify a decoded CRL against an issuer certificate.
Definition x509crl.c:695
bool(* qsc_x509_crl_signature_verify_callback)(const qsc_x509_crl *crl, const qsc_x509_certificate *issuer, void *state)
Caller supplied CRL signature verification callback.
Definition x509crl.h:188
#define QSC_X509_CRL_REVOKED_MAX
The maximum number of revoked certificate entries retained in a decoded CRL.
Definition x509crl.h:96
QSC_EXPORT_API qsc_asn1_status qsc_x509_crl_decode_der(const uint8_t *der, size_t derlen, qsc_x509_crl *crl)
Decode a DER encoded X.509 CRL.
Definition x509crl.c:459
QSC_EXPORT_API qsc_x509_crl_verify_status qsc_x509_crl_check_algorithms(const qsc_x509_crl *crl)
Check CRL signature algorithm consistency.
Definition x509crl.c:615
QSC_EXPORT_API bool qsc_x509_crl_is_revoked(const qsc_x509_crl *crl, const qsc_x509_certificate *certificate)
Test whether a certificate is revoked by a CRL.
Definition x509crl.c:756
QSC_EXPORT_API void qsc_x509_crl_clear(qsc_x509_crl *crl)
Clear a decoded CRL object.
Definition x509crl.c:353
qsc_x509_crl_verify_status_t
Definition x509crl.h:157
@ QSC_X509_CRL_VERIFY_STATUS_KEY_USAGE_REJECTED
Definition x509crl.h:166
@ QSC_X509_CRL_VERIFY_STATUS_UNSUPPORTED
Definition x509crl.h:169
@ QSC_X509_CRL_VERIFY_STATUS_INVALID_CRL
Definition x509crl.h:161
@ QSC_X509_CRL_VERIFY_STATUS_CALLBACK_FAILURE
Definition x509crl.h:168
@ QSC_X509_CRL_VERIFY_STATUS_INVALID_INPUT
Definition x509crl.h:160
@ QSC_X509_CRL_VERIFY_STATUS_ISSUER_MISMATCH
Definition x509crl.h:163
@ QSC_X509_CRL_VERIFY_STATUS_NOT_YET_VALID
Definition x509crl.h:165
@ QSC_X509_CRL_VERIFY_STATUS_EXPIRED
Definition x509crl.h:164
@ QSC_X509_CRL_VERIFY_STATUS_ALGORITHM_MISMATCH
Definition x509crl.h:162
@ QSC_X509_CRL_VERIFY_STATUS_SIGNATURE_REJECTED
Definition x509crl.h:167