20#ifndef LC_X509_PARSER_H
21#define LC_X509_PARSER_H
23#include "ext_headers.h"
98#define LC_X509_KEYS_SPHINCS_SIZE \
99 (sizeof(struct lc_sphincs_pk) + sizeof(struct lc_sphincs_sk) + \
100 sizeof(struct lc_x509_key_data))
101#define LC_X509_KEYS_SPHINCS_SET(name) \
102 _Pragma("GCC diagnostic push") \
103 _Pragma("GCC diagnostic ignored \"-Wcast-align\"")(name) \
105 (struct lc_sphincs_pk *)((uint8_t *)(name) + \
106 sizeof(struct lc_x509_key_data)); \
107 (name)->sk.sphincs_sk = \
108 (struct lc_sphincs_sk *)((uint8_t *)(name) + \
109 sizeof(struct lc_x509_key_data) + \
110 sizeof(struct lc_sphincs_pk)); \
111 (name)->data_struct_size = LC_X509_KEYS_SPHINCS_SIZE; \
112 _Pragma("GCC diagnostic pop")
114#define LC_X509_PRIVKEYS_SPHINCS_SIZE \
115 (sizeof(struct lc_sphincs_sk) + sizeof(struct lc_x509_key_data))
116#define LC_X509_PRIVKEYS_SPHINCS_SET(name) \
117 _Pragma("GCC diagnostic push") _Pragma( \
118 "GCC diagnostic ignored \"-Wcast-align\"")(name) \
119 ->pk.sphincs_pk = NULL, \
120 (name)->sk.sphincs_sk = \
121 (struct lc_sphincs_sk *)((uint8_t *)(name) + \
122 sizeof(struct lc_x509_key_data)); \
123 (name)->data_struct_size = LC_X509_PRIVKEYS_SPHINCS_SIZE; \
124 _Pragma("GCC diagnostic pop")
134#define LC_X509_KEYS_SPHINCS_ON_STACK(name) \
135 _Pragma("GCC diagnostic push") _Pragma( \
136 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
137 LC_ALIGNED_BUFFER(name##_ctx_buf, LC_X509_KEYS_SPHINCS_SIZE, \
138 LC_HASH_COMMON_ALIGNMENT); \
139 struct lc_x509_key_data *name = \
140 (struct lc_x509_key_data *)name##_ctx_buf; \
141 LC_X509_KEYS_SPHINCS_SET(name); \
142 _Pragma("GCC diagnostic pop")
152#define LC_X509_PRIVKEYS_SPHINCS_ON_STACK(name) \
153 _Pragma("GCC diagnostic push") _Pragma( \
154 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
155 LC_ALIGNED_BUFFER(name##_ctx_buf, \
156 LC_X509_PRIVKEYS_SPHINCS_SIZE, \
157 LC_HASH_COMMON_ALIGNMENT); \
158 struct lc_x509_key_data *name = \
159 (struct lc_x509_key_data *)name##_ctx_buf; \
160 LC_X509_PRIVKEYS_SPHINCS_SET(name); \
161 _Pragma("GCC diagnostic pop")
164#define LC_X509_KEYS_DILITHIUM_SIZE \
165 (sizeof(struct lc_dilithium_pk) + sizeof(struct lc_dilithium_sk) + \
166 sizeof(struct lc_x509_key_data))
167#define LC_X509_KEYS_DILITHIUM_SET(name) \
168 _Pragma("GCC diagnostic push") \
169 _Pragma("GCC diagnostic ignored \"-Wcast-align\"")(name) \
170 ->pk.dilithium_pk = \
171 (struct lc_dilithium_pk *)((uint8_t *)(name) + \
172 sizeof(struct lc_x509_key_data)); \
173 (name)->sk.dilithium_sk = \
174 (struct lc_dilithium_sk *)((uint8_t *)(name) + \
175 sizeof(struct lc_x509_key_data) + \
176 sizeof(struct lc_dilithium_pk)); \
177 (name)->data_struct_size = LC_X509_KEYS_DILITHIUM_SIZE; \
178 _Pragma("GCC diagnostic pop")
180#define LC_X509_PRIVKEYS_DILITHIUM_SIZE \
181 (sizeof(struct lc_dilithium_sk) + sizeof(struct lc_x509_key_data))
182#define LC_X509_PRIVKEYS_DILITHIUM_SET(name) \
183 _Pragma("GCC diagnostic push") _Pragma( \
184 "GCC diagnostic ignored \"-Wcast-align\"")(name) \
185 ->pk.dilithium_pk = NULL, \
186 (name)->sk.dilithium_sk = \
187 (struct lc_dilithium_sk *)((uint8_t *)(name) + \
188 sizeof(struct lc_x509_key_data)); \
189 (name)->data_struct_size = LC_X509_PRIVKEYS_DILITHIUM_SIZE; \
190 _Pragma("GCC diagnostic pop")
200#define LC_X509_KEYS_DILITHIUM_ON_STACK(name) \
201 _Pragma("GCC diagnostic push") _Pragma( \
202 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
203 LC_ALIGNED_BUFFER(name##_ctx_buf, LC_X509_KEYS_DILITHIUM_SIZE, \
204 LC_HASH_COMMON_ALIGNMENT); \
205 struct lc_x509_key_data *name = \
206 (struct lc_x509_key_data *)name##_ctx_buf; \
207 LC_X509_KEYS_DILITHIUM_SET(name); \
208 _Pragma("GCC diagnostic pop")
218#define LC_X509_PRIVKEYS_DILITHIUM_ON_STACK(name) \
219 _Pragma("GCC diagnostic push") _Pragma( \
220 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
221 LC_ALIGNED_BUFFER(name##_ctx_buf, \
222 LC_X509_PRIVKEYS_DILITHIUM_SIZE, \
223 LC_HASH_COMMON_ALIGNMENT); \
224 struct lc_x509_key_data *name = \
225 (struct lc_x509_key_data *)name##_ctx_buf; \
226 LC_X509_PRIVKEYS_DILITHIUM_SET(name); \
227 _Pragma("GCC diagnostic pop")
230#ifdef LC_DILITHIUM_ED25519_SIG
231#define LC_X509_KEYS_DILITHIUM_ED25519_SIZE \
232 (sizeof(struct lc_dilithium_ed25519_pk) + \
233 sizeof(struct lc_dilithium_ed25519_sk) + \
234 sizeof(struct lc_x509_key_data))
235#define LC_X509_KEYS_DILITHIUM_ED25519_SET(name) \
236 _Pragma("GCC diagnostic push") \
237 _Pragma("GCC diagnostic ignored \"-Wcast-align\"")(name) \
238 ->pk.dilithium_ed25519_pk = \
239 (struct lc_dilithium_ed25519_pk \
240 *)((uint8_t *)(name) + \
241 sizeof(struct lc_x509_key_data)); \
242 (name)->sk.dilithium_ed25519_sk = \
243 (struct lc_dilithium_ed25519_sk \
244 *)((uint8_t *)(name) + \
245 sizeof(struct lc_x509_key_data) + \
246 sizeof(struct lc_dilithium_ed25519_pk)); \
247 (name)->data_struct_size = LC_X509_KEYS_DILITHIUM_ED25519_SIZE; \
248 _Pragma("GCC diagnostic pop")
250#define LC_X509_PRIVKEYS_DILITHIUM_ED25519_SIZE \
251 (sizeof(struct lc_dilithium_ed25519_sk) + \
252 sizeof(struct lc_x509_key_data))
253#define LC_X509_PRIVKEYS_DILITHIUM_ED25519_SET(name) \
254 _Pragma("GCC diagnostic push") \
255 _Pragma("GCC diagnostic ignored \"-Wcast-align\"")(name) \
256 ->pk.dilithium_ed25519_pk = NULL, \
257 (name)->sk.dilithium_ed25519_sk = \
258 (struct lc_dilithium_ed25519_sk \
259 *)((uint8_t *)(name) + \
260 sizeof(struct lc_x509_key_data)); \
261 (name)->data_struct_size = LC_X509_PRIVKEYS_DILITHIUM_ED25519_SIZE; \
262 _Pragma("GCC diagnostic pop")
265#ifdef LC_DILITHIUM_ED448_SIG
266#define LC_X509_KEYS_DILITHIUM_ED448_SIZE \
267 (sizeof(struct lc_dilithium_ed448_pk) + \
268 sizeof(struct lc_dilithium_ed448_sk) + \
269 sizeof(struct lc_x509_key_data))
270#define LC_X509_KEYS_DILITHIUM_ED448_SET(name) \
271 _Pragma("GCC diagnostic push") \
272 _Pragma("GCC diagnostic ignored \"-Wcast-align\"")(name) \
273 ->pk.dilithium_ed448_pk = \
274 (struct lc_dilithium_ed448_pk \
275 *)((uint8_t *)(name) + \
276 sizeof(struct lc_x509_key_data)); \
277 (name)->sk.dilithium_ed448_sk = \
278 (struct lc_dilithium_ed448_sk \
279 *)((uint8_t *)(name) + \
280 sizeof(struct lc_x509_key_data) + \
281 sizeof(struct lc_dilithium_ed448_pk)); \
282 (name)->data_struct_size = LC_X509_KEYS_DILITHIUM_ED448_SIZE; \
283 _Pragma("GCC diagnostic pop")
285#define LC_X509_PRIVKEYS_DILITHIUM_ED448_SIZE \
286 (sizeof(struct lc_dilithium_ed448_sk) + sizeof(struct lc_x509_key_data))
287#define LC_X509_PRIVKEYS_DILITHIUM_ED448_SET(name) \
288 _Pragma("GCC diagnostic push") \
289 _Pragma("GCC diagnostic ignored \"-Wcast-align\"")(name) \
290 ->pk.dilithium_ed448_pk = NULL, \
291 (name)->sk.dilithium_ed448_sk = \
292 (struct lc_dilithium_ed448_sk \
293 *)((uint8_t *)(name) + \
294 sizeof(struct lc_x509_key_data)); \
295 (name)->data_struct_size = LC_X509_PRIVKEYS_DILITHIUM_ED448_SIZE; \
296 _Pragma("GCC diagnostic pop")
307#define LC_X509_KEYS_DILITHIUM_ED25519_ON_STACK(name) \
308 _Pragma("GCC diagnostic push") _Pragma( \
309 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
310 _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \
311 LC_ALIGNED_BUFFER(name##_ctx_buf, \
312 LC_X509_KEYS_DILITHIUM_ED25519_SIZE, \
313 LC_HASH_COMMON_ALIGNMENT); \
314 struct lc_x509_key_data *name = \
315 (struct lc_x509_key_data *)name##_ctx_buf; \
316 LC_X509_KEYS_DILITHIUM_ED25519_SET(name); \
317 _Pragma("GCC diagnostic pop")
327#define LC_X509_PRIVKEYS_DILITHIUM_ED25519_ON_STACK(name) \
328 _Pragma("GCC diagnostic push") _Pragma( \
329 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
330 _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \
333 LC_X509_PRIVKEYS_DILITHIUM_ED25519_SIZE, \
334 LC_HASH_COMMON_ALIGNMENT); \
335 struct lc_x509_key_data *name = \
336 (struct lc_x509_key_data *)name##_ctx_buf; \
337 LC_X509_PRIVKEYS_DILITHIUM_ED25519_SET(name); \
338 _Pragma("GCC diagnostic pop")
347#define LC_X509_KEYS_DILITHIUM_ED448_ON_STACK(name) \
348 _Pragma("GCC diagnostic push") _Pragma( \
349 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
350 _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \
351 LC_ALIGNED_BUFFER(name##_ctx_buf, \
352 LC_X509_KEYS_DILITHIUM_ED448_SIZE, \
353 LC_HASH_COMMON_ALIGNMENT); \
354 struct lc_x509_key_data *name = \
355 (struct lc_x509_key_data *)name##_ctx_buf; \
356 LC_X509_KEYS_DILITHIUM_ED448_SET(name); \
357 _Pragma("GCC diagnostic pop")
367#define LC_X509_PRIVKEYS_DILITHIUM_ED448_ON_STACK(name) \
368 _Pragma("GCC diagnostic push") _Pragma( \
369 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
370 _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \
373 LC_X509_PRIVKEYS_DILITHIUM_ED448_SIZE, \
374 LC_HASH_COMMON_ALIGNMENT); \
375 struct lc_x509_key_data *name = \
376 (struct lc_x509_key_data *)name##_ctx_buf; \
377 LC_X509_PRIVKEYS_DILITHIUM_ED448_SET(name); \
378 _Pragma("GCC diagnostic pop")
387#ifdef LC_DILITHIUM_ED448_SIG
388#define LC_X509_KEYS_ON_STACK(name) LC_X509_KEYS_DILITHIUM_ED448_ON_STACK(name)
389#define LC_X509_PRIVKEYS_ON_STACK(name) \
390 LC_X509_PRIVKEYS_DILITHIUM_ED448_ON_STACK(name)
391#elif defined LC_DILITHIUM_ED25519_SIG
392#define LC_X509_KEYS_ON_STACK(name) \
393 LC_X509_KEYS_DILITHIUM_ED25519_ON_STACK(name)
394#define LC_X509_PRIVKEYS_ON_STACK(name) \
395 LC_X509_PRIVKEYS_DILITHIUM_ED25519_ON_STACK(name)
396#elif defined(LC_DILITHIUM_ENABLED)
397#define LC_X509_KEYS_ON_STACK(name) LC_X509_KEYS_DILITHIUM_ON_STACK(name)
398#define LC_X509_PRIVKEYS_ON_STACK(name) \
399 LC_X509_PRIVKEYS_DILITHIUM_ON_STACK(name)
400#elif defined(LC_SPHINCS_ENABLED)
401#define LC_X509_KEYS_ON_STACK(name) LC_X509_KEYS_SPHINCS_ON_STACK(name)
402#define LC_X509_PRIVKEYS_ON_STACK(name) LC_X509_PRIVKEYS_SPHINCS_ON_STACK(name)
404#error "No known signature schemas enabled"
566 const uint8_t *data,
size_t datalen);
591 const uint8_t *data,
size_t datalen);
614 const struct lc_x509_certificate *cert,
615 const uint8_t *m,
size_t mlen,
616 const struct lc_hash *prehash_algo);
618#ifdef LC_DILITHIUM_ED25519_SIG
631 const uint8_t *pk_ptr,
size_t pk_len);
634#ifdef LC_DILITHIUM_ED448_SIG
667 const uint8_t **pk,
size_t *pk_size,
668 enum lc_sig_types *key_type);
683 const char ***eku_names,
unsigned int *num_eku);
711 const char ***keyusage_names,
712 unsigned int *num_keyusage);
743 const char **san_dns_name,
size_t *san_dns_len);
770 const uint8_t **san_ip,
size_t *san_ip_len);
799 const uint8_t **skid,
size_t *skidlen);
814 const uint8_t **akid,
size_t *akidlen);
828 time64_t *time_since_epoch);
842 time64_t *time_since_epoch);
861 const char **
string,
size_t *string_len);
880 const char **
string,
size_t *string_len);
899 const char **
string,
size_t *string_len);
918 const char **
string,
size_t *string_len);
937 const char **
string,
size_t *string_len);
956 const char **
string,
size_t *string_len);
975 const char **
string,
size_t *string_len);
994 const char **
string,
size_t *string_len);
1013 const char **
string,
size_t *string_len);
1032 const char **
string,
size_t *string_len);
1051 const char **
string,
size_t *string_len);
1070 const char **
string,
size_t *string_len);
1085 const uint8_t **serial,
size_t *serial_len);
1095#define LC_X509_POL_TRUE 1
1098#define LC_X509_POL_FALSE 0
1164 const uint8_t *reference_akid,
1165 size_t reference_akid_len);
1179 const uint8_t *reference_skid,
1180 size_t reference_skid_len);
1194 uint16_t required_key_usage);
1208 uint16_t required_eku);
1225 time64_t current_time);
1257 const struct lc_x509_certificate *cert,
1301 const struct lc_x509_certificate *cert,
1302 const struct lc_x509_certificate_name *search_name,
int lc_hash(const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
Calculate message digest - one-shot.
int lc_x509_keys_dilithium_ed448_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Dilithium-ED448 keys on heap.
int lc_x509_cert_get_issuer_o(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the issuer O field from the certificate.
int lc_x509_cert_load_pk_dilithium_ed25519(struct lc_dilithium_ed25519_pk *dilithium_ed25519_pk, const uint8_t *pk_ptr, size_t pk_len)
Parse a Composite ML-DSA ASN.1 structure into a public key structure.
int lc_x509_cert_decode(struct lc_x509_certificate *cert, const uint8_t *data, size_t datalen)
Decode an X.509 certificate.
int lc_x509_cert_get_valid_from(const struct lc_x509_certificate *cert, time64_t *time_since_epoch)
Get the valid-from data from the certificate.
int lc_x509_cert_get_eku(const struct lc_x509_certificate *cert, const char ***eku_names, unsigned int *num_eku)
Get the extended key usage in human readable form.
int lc_x509_keys_sphincs_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Sphincs Plus keys on heap.
void lc_x509_cert_clear(struct lc_x509_certificate *cert)
Clear the resources used by the X.509 certificate parsing state.
int lc_x509_privkeys_dilithium_ed25519_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Dilithium-ED25519 private keys on heap....
int lc_x509_keys_dilithium_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Dilithium keys on heap.
int lc_x509_cert_get_issuer_ou(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the issuer OU field from the certificate.
int lc_x509_privkeys_sphincs_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Sphincs Plus private keys on heap....
int lc_x509_cert_get_subject_email(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the subject email field from the certificate.
int lc_x509_cert_get_issuer_email(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the issuer email field from the certificate.
int lc_x509_cert_get_keyusage(const struct lc_x509_certificate *cert, const char ***keyusage_names, unsigned int *num_keyusage)
Get the key usage in human readable form.
int lc_x509_policy_verify_cert(const struct lc_public_key *pkey, const struct lc_x509_certificate *cert, uint64_t flags)
Verification of an X.509 certificate against a public key.
int lc_x509_cert_get_san_ip(const struct lc_x509_certificate *cert, const uint8_t **san_ip, size_t *san_ip_len)
Get the SAN IP value.
lc_x509_pol_ret_t lc_x509_policy_can_validate_crls(const struct lc_x509_certificate *cert)
Can the given certificate validate CRLs?
int lc_x509_cert_get_eku_val(const struct lc_x509_certificate *cert, uint16_t *val)
Get the extended key usage in integer form.
int lc_x509_enc_san_ip(const char *ip_name, uint8_t *ip, size_t *ip_len)
Helper to convert the human IP address value into binary form.
int lc_x509_privkeys_dilithium_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Dilithium private keys on heap....
int lc_x509_dec_san_ip(const uint8_t *ip, size_t ip_len, char *ip_name, size_t ip_name_len)
Helper to convert the binary IP address value into human-readable form.
int lc_x509_keys_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding holding any kind of key type on heap.
int lc_x509_privkeys_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding holding any kind of private key type on heap....
int lc_x509_cert_get_serial(const struct lc_x509_certificate *cert, const uint8_t **serial, size_t *serial_len)
Get the serial number of the certificate.
int lc_x509_privkeys_dilithium_ed448_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Dilithium-ED448 private keys on heap....
int lc_x509_pk_decode(struct lc_x509_key_data *key, enum lc_sig_types key_type, const uint8_t *data, size_t datalen)
Decode a public key in raw format.
int lc_x509_cert_get_skid(const struct lc_x509_certificate *cert, const uint8_t **skid, size_t *skidlen)
Get the SKID value.
int lc_x509_cert_get_akid(const struct lc_x509_certificate *cert, const uint8_t **akid, size_t *akidlen)
Get the AKID value.
int lc_x509_cert_get_pubkey(const struct lc_x509_certificate *cert, const uint8_t **pk, size_t *pk_size, enum lc_sig_types *key_type)
Get a reference of the public key data.
int lc_x509_cert_get_subject_st(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the subject ST field from the certificate.
lc_x509_pol_ret_t lc_x509_policy_is_root_ca(const struct lc_x509_certificate *cert)
Is the given certificate a root CA certificate?
int lc_x509_cert_load_pk_dilithium_ed448(struct lc_dilithium_ed448_pk *dilithium_ed448_pk, const uint8_t *pk_ptr, size_t pk_len)
Parse a Composite ML-DSA ASN.1 structure into a public key structure.
int lc_x509_cert_get_subject_cn(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the subject CN field from the certificate.
lc_x509_pol_ret_t lc_x509_policy_cert_subject_match(const struct lc_x509_certificate *cert, const struct lc_x509_certificate_name *search_name, enum lc_x509_policy_cert_subject_match_flag flag)
Match certificate against a provided name.
int lc_x509_cert_get_subject_o(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the subject O field from the certificate.
int lc_x509_cert_get_issuer_c(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the issuer C field from the certificate.
void lc_x509_keys_zero_free(struct lc_x509_key_data *keys)
Zeroize and free keys buffer.
lc_x509_pol_ret_t lc_x509_policy_match_skid(const struct lc_x509_certificate *cert, const uint8_t *reference_skid, size_t reference_skid_len)
Does the given SKID match the certificate SKID?
lc_x509_pol_ret_t lc_x509_policy_is_selfsigned(const struct lc_x509_certificate *cert)
Is the given certificate a self-signed certificate?
lc_x509_pol_ret_t lc_x509_policy_match_akid(const struct lc_x509_certificate *cert, const uint8_t *reference_akid, size_t reference_akid_len)
Does the given AKID match the certificate AKID?
int lc_x509_cert_get_issuer_cn(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the issuer CN field from the certificate.
lc_x509_pol_ret_t lc_x509_policy_match_key_usage(const struct lc_x509_certificate *cert, uint16_t required_key_usage)
Check if set of required key usage flags are present.
lc_x509_pol_ret_t lc_x509_policy_match_extended_key_usage(const struct lc_x509_certificate *cert, uint16_t required_eku)
Check if set of required extended key usage flags are present.
int lc_x509_cert_get_subject_c(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the subject C field from the certificate.
int lc_x509_signature_verify(const uint8_t *sig_data, size_t siglen, const struct lc_x509_certificate *cert, const uint8_t *m, size_t mlen, const struct lc_hash *prehash_algo)
Verify signature over user-supplied data.
int lc_x509_cert_get_keyusage_val(const struct lc_x509_certificate *cert, uint16_t *val)
Get the key usage in integer form.
int lc_x509_cert_get_issuer_st(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the issuer ST field from the certificate.
lc_x509_pol_ret_t lc_x509_policy_time_valid(const struct lc_x509_certificate *cert, time64_t current_time)
Check if the given time falls within the range of the certificate validity time.
int lc_x509_keys_dilithium_ed25519_alloc(struct lc_x509_key_data **keys)
Allocate memory for struct lc_x509_keys_data holding Dilithium-ED25519 keys on heap.
int lc_x509_cert_get_san_dns(const struct lc_x509_certificate *cert, const char **san_dns_name, size_t *san_dns_len)
Get the SAN DNS name.
lc_x509_pol_ret_t lc_x509_policy_cert_valid(const struct lc_x509_certificate *cert)
Check if certificate is valid.
lc_x509_pol_ret_t lc_x509_policy_is_ca(const struct lc_x509_certificate *cert)
Is the given certificate a CA certificate (root or intermediate)?
int lc_x509_cert_get_valid_to(const struct lc_x509_certificate *cert, time64_t *time_since_epoch)
Get the valid-to data from the certificate.
int lc_x509_cert_get_subject_ou(const struct lc_x509_certificate *cert, const char **string, size_t *string_len)
Get the subject OU field from the certificate.
int lc_x509_sk_decode(struct lc_x509_key_data *key, enum lc_sig_types key_type, const uint8_t *data, size_t datalen)
Decode a private key in DER format.
static void lc_memset_secure(void *s, int c, size_t n)
lc_x509_policy_cert_subject_match_flag
@ lc_x509_policy_cert_subject_match_issuer_only
@ lc_x509_policy_cert_subject_match_dn_only
@ lc_x509_policy_cert_subject_match_dn_and_san
@ lc_x509_policy_cert_subject_match_san_name_only
@ lc_x509_policy_cert_subject_match_san_email_only
@ lc_x509_policy_cert_subject_match_san_dns_only
@ lc_x509_policy_cert_subject_match_san_ip_only
static void lc_x509_keys_zero(struct lc_x509_key_data *keys)
Zeroize Dilithium context allocated with LC_X509_*KEYS*_ON_STACK.