Botan 3.9.0
Crypto and TLS for C&
ffi_cert.cpp
Go to the documentation of this file.
1/*
2* (C) 2015,2017,2018 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#include <botan/ffi.h>
8
9#include <botan/internal/ffi_pkey.h>
10#include <botan/internal/ffi_util.h>
11#include <memory>
12
13#if defined(BOTAN_HAS_X509_CERTIFICATES)
14 #include <botan/data_src.h>
15 #include <botan/x509_crl.h>
16 #include <botan/x509cert.h>
17 #include <botan/x509path.h>
18#endif
19
20extern "C" {
21
22using namespace Botan_FFI;
23
24#if defined(BOTAN_HAS_X509_CERTIFICATES)
25
26BOTAN_FFI_DECLARE_STRUCT(botan_x509_cert_struct, Botan::X509_Certificate, 0x8F628937);
27
28#endif
29
30int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* cert_path) {
31 if(cert_obj == nullptr || cert_path == nullptr) {
33 }
34
35#if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
36
37 return ffi_guard_thunk(__func__, [=]() -> int {
38 auto c = std::make_unique<Botan::X509_Certificate>(cert_path);
39 return ffi_new_object(cert_obj, std::move(c));
40 });
41
42#else
44#endif
45}
46
48 if(cert_obj == nullptr) {
50 }
51
52#if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
53
54 return ffi_guard_thunk(__func__, [=]() -> int {
55 auto c = std::make_unique<Botan::X509_Certificate>(safe_get(cert));
56 return ffi_new_object(cert_obj, std::move(c));
57 });
58
59#else
60 BOTAN_UNUSED(cert);
62#endif
63}
64
65int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert_bits[], size_t cert_bits_len) {
66 if(cert_obj == nullptr || cert_bits == nullptr) {
68 }
69
70#if defined(BOTAN_HAS_X509_CERTIFICATES)
71 return ffi_guard_thunk(__func__, [=]() -> int {
72 Botan::DataSource_Memory bits(cert_bits, cert_bits_len);
73 auto c = std::make_unique<Botan::X509_Certificate>(bits);
74 return ffi_new_object(cert_obj, std::move(c));
75 });
76#else
77 BOTAN_UNUSED(cert_bits_len);
79#endif
80}
81
83 if(key == nullptr) {
85 }
86
87 *key = nullptr;
88
89#if defined(BOTAN_HAS_X509_CERTIFICATES)
90 return ffi_guard_thunk(__func__, [=]() -> int {
91 auto public_key = safe_get(cert).subject_public_key();
92 return ffi_new_object(key, std::move(public_key));
93 });
94#else
95 BOTAN_UNUSED(cert);
97#endif
98}
99
101 botan_x509_cert_t cert, const char* key, size_t index, uint8_t out[], size_t* out_len) {
102#if defined(BOTAN_HAS_X509_CERTIFICATES)
103 return BOTAN_FFI_VISIT(cert, [=](const auto& c) -> int {
104 auto issuer_info = c.issuer_info(key);
105 if(index < issuer_info.size()) {
106 // TODO(Botan4) change the type of out and remove this cast
107 return write_str_output(reinterpret_cast<char*>(out), out_len, c.issuer_info(key).at(index));
108 } else {
110 }
111 });
112#else
113 BOTAN_UNUSED(cert, key, index, out, out_len);
115#endif
116}
117
119 botan_x509_cert_t cert, const char* key, size_t index, uint8_t out[], size_t* out_len) {
120#if defined(BOTAN_HAS_X509_CERTIFICATES)
121 return BOTAN_FFI_VISIT(cert, [=](const auto& c) -> int {
122 auto subject_info = c.subject_info(key);
123 if(index < subject_info.size()) {
124 // TODO(Botan4) change the type of out and remove this cast
125 return write_str_output(reinterpret_cast<char*>(out), out_len, c.subject_info(key).at(index));
126 } else {
128 }
129 });
130#else
131 BOTAN_UNUSED(cert, key, index, out, out_len);
133#endif
134}
135
136int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len) {
137 return copy_view_str(reinterpret_cast<uint8_t*>(out), out_len, botan_x509_cert_view_as_string, cert);
138}
139
141#if defined(BOTAN_HAS_X509_CERTIFICATES)
142 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { return invoke_view_callback(view, ctx, c.to_string()); });
143#else
144 BOTAN_UNUSED(cert, ctx, view);
146#endif
147}
148
149int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage) {
150#if defined(BOTAN_HAS_X509_CERTIFICATES)
151 return BOTAN_FFI_VISIT(cert, [=](const auto& c) -> int {
152 const Botan::Key_Constraints k = static_cast<Botan::Key_Constraints>(key_usage);
153 if(c.allowed_usage(k)) {
154 return BOTAN_FFI_SUCCESS;
155 }
156 return 1;
157 });
158#else
159 BOTAN_UNUSED(cert, key_usage);
161#endif
162}
163
165#if defined(BOTAN_HAS_X509_CERTIFICATES)
166 return BOTAN_FFI_CHECKED_DELETE(cert);
167#else
168 BOTAN_UNUSED(cert);
170#endif
171}
172
173int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len) {
174#if defined(BOTAN_HAS_X509_CERTIFICATES)
175 return BOTAN_FFI_VISIT(cert,
176 [=](const auto& c) { return write_str_output(out, out_len, c.not_before().to_string()); });
177#else
178 BOTAN_UNUSED(cert, out, out_len);
180#endif
181}
182
183int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len) {
184#if defined(BOTAN_HAS_X509_CERTIFICATES)
185 return BOTAN_FFI_VISIT(cert,
186 [=](const auto& c) { return write_str_output(out, out_len, c.not_after().to_string()); });
187#else
188 BOTAN_UNUSED(cert, out, out_len);
190#endif
191}
192
193int botan_x509_cert_not_before(botan_x509_cert_t cert, uint64_t* time_since_epoch) {
194#if defined(BOTAN_HAS_X509_CERTIFICATES)
195 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { *time_since_epoch = c.not_before().time_since_epoch(); });
196#else
197 BOTAN_UNUSED(cert, time_since_epoch);
199#endif
200}
201
202int botan_x509_cert_not_after(botan_x509_cert_t cert, uint64_t* time_since_epoch) {
203#if defined(BOTAN_HAS_X509_CERTIFICATES)
204 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { *time_since_epoch = c.not_after().time_since_epoch(); });
205#else
206 BOTAN_UNUSED(cert, time_since_epoch);
208#endif
209}
210
211int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t* out_len) {
212#if defined(BOTAN_HAS_X509_CERTIFICATES)
213 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { return write_vec_output(out, out_len, c.serial_number()); });
214#else
215 BOTAN_UNUSED(cert, out, out_len);
217#endif
218}
219
220int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char* hash, uint8_t out[], size_t* out_len) {
221#if defined(BOTAN_HAS_X509_CERTIFICATES)
222 // TODO(Botan4) change the type of out and remove this cast
223
224 return BOTAN_FFI_VISIT(cert, [=](const auto& c) {
225 return write_str_output(reinterpret_cast<char*>(out), out_len, c.fingerprint(hash));
226 });
227#else
228 BOTAN_UNUSED(cert, hash, out, out_len);
230#endif
231}
232
233int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len) {
234#if defined(BOTAN_HAS_X509_CERTIFICATES)
235 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { return write_vec_output(out, out_len, c.authority_key_id()); });
236#else
237 BOTAN_UNUSED(cert, out, out_len);
239#endif
240}
241
242int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len) {
243#if defined(BOTAN_HAS_X509_CERTIFICATES)
244 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { return write_vec_output(out, out_len, c.subject_key_id()); });
245#else
246 BOTAN_UNUSED(cert, out, out_len);
248#endif
249}
250
251int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert, uint8_t out[], size_t* out_len) {
252 return copy_view_bin(out, out_len, botan_x509_cert_view_public_key_bits, cert);
253}
254
256#if defined(BOTAN_HAS_X509_CERTIFICATES)
257 return BOTAN_FFI_VISIT(cert,
258 [=](const auto& c) { return invoke_view_callback(view, ctx, c.subject_public_key_bits()); });
259#else
260 BOTAN_UNUSED(cert, ctx, view);
262#endif
263}
264
265int botan_x509_cert_hostname_match(botan_x509_cert_t cert, const char* hostname) {
266 if(hostname == nullptr) {
268 }
269
270#if defined(BOTAN_HAS_X509_CERTIFICATES)
271 return BOTAN_FFI_VISIT(cert, [=](const auto& c) { return c.matches_dns_name(hostname) ? 0 : -1; });
272#else
273 BOTAN_UNUSED(cert);
275#endif
276}
277
278int botan_x509_cert_verify(int* result_code,
280 const botan_x509_cert_t* intermediates,
281 size_t intermediates_len,
282 const botan_x509_cert_t* trusted,
283 size_t trusted_len,
284 const char* trusted_path,
285 size_t required_strength,
286 const char* hostname_cstr,
287 uint64_t reference_time) {
288 if(required_strength == 0) {
289 required_strength = 110;
290 }
291
292#if defined(BOTAN_HAS_X509_CERTIFICATES)
293 return ffi_guard_thunk(__func__, [=]() -> int {
294 const std::string hostname((hostname_cstr == nullptr) ? "" : hostname_cstr);
296 const auto validation_time = reference_time == 0
297 ? std::chrono::system_clock::now()
298 : std::chrono::system_clock::from_time_t(static_cast<time_t>(reference_time));
299
300 std::vector<Botan::X509_Certificate> end_certs;
301 end_certs.push_back(safe_get(cert));
302 for(size_t i = 0; i != intermediates_len; ++i) {
303 end_certs.push_back(safe_get(intermediates[i]));
304 }
305
306 std::unique_ptr<Botan::Certificate_Store> trusted_from_path;
307 std::unique_ptr<Botan::Certificate_Store_In_Memory> trusted_extra;
308 std::vector<Botan::Certificate_Store*> trusted_roots;
309
310 if(trusted_path != nullptr && *trusted_path != 0) {
311 trusted_from_path = std::make_unique<Botan::Certificate_Store_In_Memory>(trusted_path);
312 trusted_roots.push_back(trusted_from_path.get());
313 }
314
315 if(trusted_len > 0) {
316 trusted_extra = std::make_unique<Botan::Certificate_Store_In_Memory>();
317 for(size_t i = 0; i != trusted_len; ++i) {
318 trusted_extra->add_certificate(safe_get(trusted[i]));
319 }
320 trusted_roots.push_back(trusted_extra.get());
321 }
322
323 Botan::Path_Validation_Restrictions restrictions(false, required_strength);
324
325 auto validation_result =
326 Botan::x509_path_validate(end_certs, restrictions, trusted_roots, hostname, usage, validation_time);
327
328 if(result_code != nullptr) {
329 *result_code = static_cast<int>(validation_result.result());
330 }
331
332 if(validation_result.successful_validation()) {
333 return 0;
334 } else {
335 return 1;
336 }
337 });
338#else
339 BOTAN_UNUSED(result_code, cert, intermediates, intermediates_len, trusted);
340 BOTAN_UNUSED(trusted_len, trusted_path, hostname_cstr, reference_time);
342#endif
343}
344
346 if(code < 0) {
347 return nullptr;
348 }
349
350#if defined(BOTAN_HAS_X509_CERTIFICATES)
352 return Botan::to_string(sc);
353#else
354 return nullptr;
355#endif
356}
357
358#if defined(BOTAN_HAS_X509_CERTIFICATES)
359
360BOTAN_FFI_DECLARE_STRUCT(botan_x509_crl_struct, Botan::X509_CRL, 0x2C628910);
361
362#endif
363
364int botan_x509_crl_load_file(botan_x509_crl_t* crl_obj, const char* crl_path) {
365 if(crl_obj == nullptr || crl_path == nullptr) {
367 }
368
369#if defined(BOTAN_HAS_X509_CERTIFICATES) && defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
370
371 return ffi_guard_thunk(__func__, [=]() -> int {
372 auto c = std::make_unique<Botan::X509_CRL>(crl_path);
373 return ffi_new_object(crl_obj, std::move(c));
374 });
375
376#else
378#endif
379}
380
381int botan_x509_crl_load(botan_x509_crl_t* crl_obj, const uint8_t crl_bits[], size_t crl_bits_len) {
382 if(crl_obj == nullptr || crl_bits == nullptr) {
384 }
385
386#if defined(BOTAN_HAS_X509_CERTIFICATES)
387 return ffi_guard_thunk(__func__, [=]() -> int {
388 Botan::DataSource_Memory bits(crl_bits, crl_bits_len);
389 auto c = std::make_unique<Botan::X509_CRL>(bits);
390 return ffi_new_object(crl_obj, std::move(c));
391 });
392#else
393 BOTAN_UNUSED(crl_bits_len);
395#endif
396}
397
399#if defined(BOTAN_HAS_X509_CERTIFICATES)
400 return BOTAN_FFI_CHECKED_DELETE(crl);
401#else
402 BOTAN_UNUSED(crl);
404#endif
405}
406
408#if defined(BOTAN_HAS_X509_CERTIFICATES)
409 return BOTAN_FFI_VISIT(crl, [=](const auto& c) { return c.is_revoked(safe_get(cert)) ? 0 : -1; });
410#else
411 BOTAN_UNUSED(cert);
412 BOTAN_UNUSED(crl);
414#endif
415}
416
419 const botan_x509_cert_t* intermediates,
420 size_t intermediates_len,
421 const botan_x509_cert_t* trusted,
422 size_t trusted_len,
423 const botan_x509_crl_t* crls,
424 size_t crls_len,
425 const char* trusted_path,
426 size_t required_strength,
427 const char* hostname_cstr,
428 uint64_t reference_time) {
429 if(required_strength == 0) {
430 required_strength = 110;
431 }
432
433#if defined(BOTAN_HAS_X509_CERTIFICATES)
434 return ffi_guard_thunk(__func__, [=]() -> int {
435 const std::string hostname((hostname_cstr == nullptr) ? "" : hostname_cstr);
437 const auto validation_time = reference_time == 0
438 ? std::chrono::system_clock::now()
439 : std::chrono::system_clock::from_time_t(static_cast<time_t>(reference_time));
440
441 std::vector<Botan::X509_Certificate> end_certs;
442 end_certs.push_back(safe_get(cert));
443 for(size_t i = 0; i != intermediates_len; ++i) {
444 end_certs.push_back(safe_get(intermediates[i]));
445 }
446
447 std::unique_ptr<Botan::Certificate_Store> trusted_from_path;
448 std::unique_ptr<Botan::Certificate_Store_In_Memory> trusted_extra;
449 std::unique_ptr<Botan::Certificate_Store_In_Memory> trusted_crls;
450 std::vector<Botan::Certificate_Store*> trusted_roots;
451
452 if(trusted_path != nullptr && *trusted_path != 0) {
453 trusted_from_path = std::make_unique<Botan::Certificate_Store_In_Memory>(trusted_path);
454 trusted_roots.push_back(trusted_from_path.get());
455 }
456
457 if(trusted_len > 0) {
458 trusted_extra = std::make_unique<Botan::Certificate_Store_In_Memory>();
459 for(size_t i = 0; i != trusted_len; ++i) {
460 trusted_extra->add_certificate(safe_get(trusted[i]));
461 }
462 trusted_roots.push_back(trusted_extra.get());
463 }
464
465 if(crls_len > 0) {
466 trusted_crls = std::make_unique<Botan::Certificate_Store_In_Memory>();
467 for(size_t i = 0; i != crls_len; ++i) {
468 trusted_crls->add_crl(safe_get(crls[i]));
469 }
470 trusted_roots.push_back(trusted_crls.get());
471 }
472
473 Botan::Path_Validation_Restrictions restrictions(false, required_strength);
474
475 auto validation_result =
476 Botan::x509_path_validate(end_certs, restrictions, trusted_roots, hostname, usage, validation_time);
477
478 if(result_code != nullptr) {
479 *result_code = static_cast<int>(validation_result.result());
480 }
481
482 if(validation_result.successful_validation()) {
483 return 0;
484 } else {
485 return 1;
486 }
487 });
488#else
489 BOTAN_UNUSED(result_code, cert, intermediates, intermediates_len, trusted);
490 BOTAN_UNUSED(trusted_len, trusted_path, hostname_cstr, reference_time, crls, crls_len);
492#endif
493}
494}
#define BOTAN_UNUSED
Definition assert.h:144
struct botan_pubkey_struct * botan_pubkey_t
Definition ffi.h:1537
struct botan_x509_crl_struct * botan_x509_crl_t
Definition ffi.h:2208
int botan_x509_cert_view_as_string(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_str_fn view)
Definition ffi_cert.cpp:140
int(* botan_view_bin_fn)(botan_view_ctx view_ctx, const uint8_t *data, size_t len)
Definition ffi.h:161
struct botan_x509_cert_struct * botan_x509_cert_t
Definition ffi.h:2107
void * botan_view_ctx
Definition ffi.h:152
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
Definition ffi.h:138
@ BOTAN_FFI_ERROR_NULL_POINTER
Definition ffi.h:132
@ BOTAN_FFI_SUCCESS
Definition ffi.h:115
@ BOTAN_FFI_ERROR_BAD_PARAMETER
Definition ffi.h:133
int botan_x509_cert_view_public_key_bits(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_bin_fn view)
Definition ffi_cert.cpp:255
int(* botan_view_str_fn)(botan_view_ctx view_ctx, const char *str, size_t len)
Definition ffi.h:170
int botan_x509_is_revoked(botan_x509_crl_t crl, botan_x509_cert_t cert)
Definition ffi_cert.cpp:407
int botan_x509_crl_destroy(botan_x509_crl_t crl)
Definition ffi_cert.cpp:398
int botan_x509_cert_destroy(botan_x509_cert_t cert)
Definition ffi_cert.cpp:164
int botan_x509_cert_load_file(botan_x509_cert_t *cert_obj, const char *cert_path)
Definition ffi_cert.cpp:30
int botan_x509_cert_dup(botan_x509_cert_t *cert_obj, botan_x509_cert_t cert)
Definition ffi_cert.cpp:47
int botan_x509_cert_verify_with_crl(int *result_code, 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_cstr, uint64_t reference_time)
Definition ffi_cert.cpp:417
int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t *key)
Definition ffi_cert.cpp:82
const char * botan_x509_cert_validation_status(int code)
Definition ffi_cert.cpp:345
int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition ffi_cert.cpp:233
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)
Definition ffi_cert.cpp:100
int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t *out_len)
Definition ffi_cert.cpp:183
int botan_x509_cert_view_as_string(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_str_fn view)
Definition ffi_cert.cpp:140
int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t *out_len)
Definition ffi_cert.cpp:173
int botan_x509_cert_load(botan_x509_cert_t *cert_obj, const uint8_t cert_bits[], size_t cert_bits_len)
Definition ffi_cert.cpp:65
int botan_x509_crl_load(botan_x509_crl_t *crl_obj, const uint8_t crl_bits[], size_t crl_bits_len)
Definition ffi_cert.cpp:381
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)
Definition ffi_cert.cpp:118
int botan_x509_cert_not_before(botan_x509_cert_t cert, uint64_t *time_since_epoch)
Definition ffi_cert.cpp:193
int botan_x509_cert_verify(int *result_code, 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_cstr, uint64_t reference_time)
Definition ffi_cert.cpp:278
int botan_x509_cert_hostname_match(botan_x509_cert_t cert, const char *hostname)
Definition ffi_cert.cpp:265
int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition ffi_cert.cpp:211
int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition ffi_cert.cpp:242
int botan_x509_cert_view_public_key_bits(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_bin_fn view)
Definition ffi_cert.cpp:255
int botan_x509_crl_load_file(botan_x509_crl_t *crl_obj, const char *crl_path)
Definition ffi_cert.cpp:364
int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage)
Definition ffi_cert.cpp:149
int botan_x509_cert_not_after(botan_x509_cert_t cert, uint64_t *time_since_epoch)
Definition ffi_cert.cpp:202
int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition ffi_cert.cpp:251
int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char *hash, uint8_t out[], size_t *out_len)
Definition ffi_cert.cpp:220
int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t *out_len)
Definition ffi_cert.cpp:136
#define BOTAN_FFI_VISIT(obj, lambda)
Definition ffi_util.h:158
#define BOTAN_FFI_CHECKED_DELETE(o)
Definition ffi_util.h:185
#define BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC)
Definition ffi_util.h:61
int invoke_view_callback(botan_view_bin_fn view, botan_view_ctx ctx, std::span< const uint8_t > buf)
Definition ffi_util.h:187
int copy_view_bin(uint8_t out[], size_t *out_len, Fn fn, Args... args)
Definition ffi_util.h:211
T & safe_get(botan_struct< T, M > *p)
Definition ffi_util.h:79
BOTAN_FFI_ERROR ffi_new_object(T *obj, Args &&... args)
Definition ffi_util.h:178
int copy_view_str(uint8_t out[], size_t *out_len, Fn fn, Args... args)
Definition ffi_util.h:217
int ffi_guard_thunk(const char *func_name, T thunk)
Definition ffi_util.h:95
int write_vec_output(uint8_t out[], size_t *out_len, std::span< const uint8_t > buf)
Definition ffi_util.h:247
int write_str_output(char out[], size_t *out_len, const std::string &str)
Definition ffi_util.h:251
Certificate_Status_Code
Definition pkix_enums.h:20
Path_Validation_Result x509_path_validate(const std::vector< X509_Certificate > &end_certs, const Path_Validation_Restrictions &restrictions, const std::vector< Certificate_Store * > &trusted_roots, std::string_view hostname, Usage_Type usage, std::chrono::system_clock::time_point ref_time, std::chrono::milliseconds ocsp_timeout, const std::vector< std::optional< OCSP::Response > > &ocsp_resp)
Definition x509path.cpp:883
std::string to_string(ErrorType type)
Convert an ErrorType to string.
Definition exceptn.cpp:13
Usage_Type
Definition x509cert.h:22