Botan 3.14.1
Crypto and TLS for C&
x509path.h
Go to the documentation of this file.
1/*
2* X.509 Cert Path Validation
3* (C) 2010-2011 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_X509_CERT_PATH_VALIDATION_H_
9#define BOTAN_X509_CERT_PATH_VALIDATION_H_
10
11#include <botan/certstor.h>
12#include <botan/ocsp.h>
13#include <botan/pkix_enums.h>
14#include <botan/x509cert.h>
15#include <chrono>
16#include <optional>
17#include <set>
18
19#if defined(BOTAN_TARGET_OS_HAS_THREADS) && defined(BOTAN_HAS_HTTP_UTIL)
20 #define BOTAN_HAS_ONLINE_REVOCATION_CHECKS
21#endif
22
23namespace Botan {
24
25/**
26* This type represents the validation status of an entire certificate path.
27* There is one set of status codes for each certificate in the path.
28*/
29typedef std::vector<std::set<Certificate_Status_Code>> CertificatePathStatusCodes;
30
31/**
32* Specifies restrictions on the PKIX path validation
33*/
35 public:
36 /**
37 * @param require_rev if true, revocation information is required
38
39 * @param minimum_key_strength is the minimum strength (in terms of
40 * operations, eg 80 means 2^80) of a signature. Signatures weaker than
41 * this are rejected. If more than 80, SHA-1 signatures are also
42 * rejected. If possible use at least setting 110.
43 *
44 * 80 bit strength requires 1024 bit RSA
45 * 110 bit strength requires 2k bit RSA
46 * 128 bit strength requires ~3k bit RSA or P-256
47 * @param ocsp_all_intermediates Make OCSP requests for all CAs as
48 * well as end entity (if OCSP enabled in path validation request)
49 * @param max_ocsp_age maximum age of OCSP responses w/o next_update.
50 * If zero, there is no maximum age
51 * @param trusted_ocsp_responders optional certificate store containing certificates
52 * of trusted OCSP responders (additionally to the CA's responders)
53 * @param ignore_trusted_root_time_range if true, validity checks on the
54 * time range of the trusted root certificate only produce warnings
55 * @param require_self_signed_trust_anchors if true, only certificates which
56 * appear to be self-signed are allowed as trust anchors. Trust anchors
57 * based on intermediate and leaf certificates are forbidden in this case.
58 * The self-signature itself is not verified.
59 * @param accept_ocsp_softfail if true then soft fail conditions (the OCSP
60 * responder being unavailable or returning an error status, no
61 * responder URL, or the library being built without HTTP support)
62 * will be accepted as satisfying revocation requirements.
63 * Not recommended.
64 */
66 bool require_rev = false,
67 size_t minimum_key_strength = 110,
68 bool ocsp_all_intermediates = false,
69 std::chrono::seconds max_ocsp_age = std::chrono::hours(24 * 7),
70 std::unique_ptr<Certificate_Store> trusted_ocsp_responders = nullptr,
73 bool accept_ocsp_softfail = false);
74
75 /**
76 * @param require_rev if true, revocation information is required
77 * @param minimum_key_strength is the minimum strength (in terms of
78 * operations, eg 80 means 2^80) of a signature. Signatures
79 * weaker than this are rejected.
80 * @param ocsp_all_intermediates Make OCSP requests for all CAs as
81 * well as end entity (if OCSP enabled in path validation request)
82 * @param trusted_hashes a set of trusted hashes. Any signatures
83 * created using a hash other than one of these will be
84 * rejected.
85 * @param max_ocsp_age maximum age of OCSP responses w/o next_update.
86 * If zero, there is no maximum age
87 * @param trusted_ocsp_responders optional certificate store containing certificates
88 * of trusted OCSP responders (additionally to the CA's responders)
89 * @param ignore_trusted_root_time_range if true, validity checks on the
90 * time range of the trusted root certificate only produce warnings
91 * @param require_self_signed_trust_anchors if true, only certificates which
92 * appear to be self-signed are allowed as trust anchors. Trust anchors
93 * based on intermediate and leaf certificates are forbidden in this case.
94 * The self-signature itself is not verified.
95 * @param accept_ocsp_softfail if true then soft fail conditions (the OCSP
96 * responder being unavailable or returning an error status, no
97 * responder URL, or the library being built without HTTP support)
98 * will be accepted as satisfying revocation requirements.
99 * Not recommended.
100 */
104 const std::set<std::string>& trusted_hashes,
105 std::chrono::seconds max_ocsp_age = std::chrono::hours(24 * 7),
106 std::unique_ptr<Certificate_Store> trusted_ocsp_responders = nullptr,
109 bool accept_ocsp_softfail = false) :
110 m_require_revocation_information(require_rev),
111 m_ocsp_all_intermediates(ocsp_all_intermediates),
112 m_trusted_hashes(trusted_hashes),
113 m_minimum_key_strength(minimum_key_strength),
114 m_max_ocsp_age(max_ocsp_age),
115 m_trusted_ocsp_responders(std::move(trusted_ocsp_responders)),
116 m_ignore_trusted_root_time_range(ignore_trusted_root_time_range),
117 m_require_self_signed_trust_anchors(require_self_signed_trust_anchors),
118 m_accept_ocsp_softfail(accept_ocsp_softfail) {}
119
120 /**
121 * @return whether revocation information is required
122 */
123 bool require_revocation_information() const { return m_require_revocation_information; }
124
125 /**
126 * @return whether all intermediate CAs should also be OCSPed. If false
127 * then only end entity OCSP is required/requested.
128 */
129 bool ocsp_all_intermediates() const { return m_ocsp_all_intermediates; }
130
131 /**
132 * @return trusted signature hash functions
133 */
134 const std::set<std::string>& trusted_hashes() const { return m_trusted_hashes; }
135
136 /**
137 * @return minimum required key strength
138 */
139 size_t minimum_key_strength() const { return m_minimum_key_strength; }
140
141 /**
142 * @return maximum age of OCSP responses w/o next_update.
143 * If zero, there is no maximum age
144 */
145 std::chrono::seconds max_ocsp_age() const { return m_max_ocsp_age; }
146
147 /**
148 * Certificates in this store are trusted to sign OCSP responses
149 * additionally to the CA's responder certificates.
150 * @return certificate store containing trusted OCSP responder certs
151 */
152 const Certificate_Store* trusted_ocsp_responders() const { return m_trusted_ocsp_responders.get(); }
153
154 /**
155 * RFC 5280 does not disallow trusted anchors signing certificates with wider validity
156 * ranges than theirs. When checking a certificate chain at a specific
157 * point in time, this can lead to situations where a root certificate is expired, but
158 * the lower-chain certificates are not.
159 *
160 * If this flag is set to true, such chains are considered valid (with warning
161 * TRUSTED_CERT_HAS_EXPIRED). Otherwise, the chain is rejected with the error
162 * code CERT_HAS_EXPIRED. The same holds for not yet valid certificates with the
163 * error code CERT_NOT_YET_VALID (or warning TRUSTED_CERT_NOT_YET_VALID).
164 */
165 bool ignore_trusted_root_time_range() const { return m_ignore_trusted_root_time_range; }
166
167 /**
168 * By default Botan requires trust anchors to appear self-signed; the
169 * self-signature itself is not verified.
170 * This prevents using intermediate CA certificates and leaf certificates
171 * as trust anchors, even if they are included in the Certificate Store.
172 * This restriction can be removed by setting
173 * require_self_signed_trust_anchors=false in the constructor.
174 */
175 bool require_self_signed_trust_anchors() const { return m_require_self_signed_trust_anchors; }
176
177 /**
178 * By default OCSP soft-fail conditions (such as a network error)
179 * do not count as satisfying revocation requirements.
180 * This restriction can be removed by setting
181 * accept_ocsp_softfail=true in the constructor.
182 */
183 bool accept_ocsp_softfail() const { return m_accept_ocsp_softfail; }
184
185 private:
186 bool m_require_revocation_information;
187 bool m_ocsp_all_intermediates;
188 std::set<std::string> m_trusted_hashes;
189 size_t m_minimum_key_strength;
190 std::chrono::seconds m_max_ocsp_age;
191 std::unique_ptr<Certificate_Store> m_trusted_ocsp_responders;
192 bool m_ignore_trusted_root_time_range;
193 bool m_require_self_signed_trust_anchors;
194 bool m_accept_ocsp_softfail;
195};
196
197/**
198* Represents the result of a PKIX path validation
199*/
201 public:
203
204 /**
205 * @return the trust root of the validation if successful
206 * throws an exception if the validation failed
207 */
208 const X509_Certificate& trust_root() const;
209
210 /**
211 * @return the full path from subject to trust root
212 * This path may be empty
213 */
214 const std::vector<X509_Certificate>& cert_path() const { return m_cert_path; }
215
216 /**
217 * @return true iff the validation was successful
218 */
219 bool successful_validation() const;
220
221 /**
222 * @return true iff no warnings occurred during validation
223 */
224 bool no_warnings() const;
225
226 /**
227 * @return overall validation result code
228 */
229 Certificate_Status_Code result() const { return m_overall; }
230
231 /**
232 * @return a set of status codes for each certificate in the chain
233 */
234 const CertificatePathStatusCodes& all_statuses() const { return m_all_status; }
235
236 /**
237 * @return the subset of status codes that are warnings
238 */
239 CertificatePathStatusCodes warnings() const;
240
241 /**
242 * @return string representation of the validation result
243 */
244 std::string result_string() const;
245
246 /**
247 * @return string representation of the warnings
248 */
249 std::string warnings_string() const;
250
251 /**
252 * @param code validation status code
253 * @return corresponding validation status message
254 */
255 static const char* status_string(Certificate_Status_Code code);
256
257 /**
258 * Create a Path_Validation_Result
259 * @param status list of validation status codes
260 * @param cert_chain the certificate chain that was validated
261 */
262 Path_Validation_Result(CertificatePathStatusCodes status, std::vector<X509_Certificate>&& cert_chain);
263
264 /**
265 * Create a Path_Validation_Result
266 * @param status validation status code
267 */
268 explicit Path_Validation_Result(Certificate_Status_Code status) : m_overall(status) {}
269
270 private:
271 CertificatePathStatusCodes m_all_status;
273 std::vector<X509_Certificate> m_cert_path;
274 Certificate_Status_Code m_overall;
275};
276
277/**
278* PKIX Path Validation
279* @param end_certs certificate chain to validate (with end entity certificate in end_certs[0])
280* @param restrictions path validation restrictions
281* @param trusted_roots list of certificate stores that contain trusted certificates
282* @param hostname if not empty, compared against the DNS name in end_certs[0]
283* @param usage if not set to UNSPECIFIED, compared against the key usage in end_certs[0]
284* @param validation_time what reference time to use for validation
285* @param ocsp_timeout timeout for OCSP operations, 0 disables OCSP check
286* @param ocsp_resp additional OCSP responses to consider (eg from peer)
287* @return result of the path validation
288*/
289Path_Validation_Result BOTAN_PUBLIC_API(2, 0)
290 x509_path_validate(const std::vector<X509_Certificate>& end_certs,
291 const Path_Validation_Restrictions& restrictions,
292 const std::vector<Certificate_Store*>& trusted_roots,
293 std::string_view hostname = "",
295 std::chrono::system_clock::time_point validation_time = std::chrono::system_clock::now(),
296 std::chrono::milliseconds ocsp_timeout = std::chrono::milliseconds(0),
297 const std::vector<std::optional<OCSP::Response>>& ocsp_resp = {});
298
299/**
300* PKIX Path Validation
301* @param end_cert certificate to validate
302* @param restrictions path validation restrictions
303* @param trusted_roots list of stores that contain trusted certificates
304* @param hostname if not empty, compared against the DNS name in end_cert
305* @param usage if not set to UNSPECIFIED, compared against the key usage in end_cert
306* @param validation_time what reference time to use for validation
307* @param ocsp_timeout timeout for OCSP operations, 0 disables OCSP check
308* @param ocsp_resp additional OCSP responses to consider (eg from peer)
309* @return result of the path validation
310*/
312 x509_path_validate(const X509_Certificate& end_cert,
313 const Path_Validation_Restrictions& restrictions,
314 const std::vector<Certificate_Store*>& trusted_roots,
315 std::string_view hostname = "",
317 std::chrono::system_clock::time_point validation_time = std::chrono::system_clock::now(),
318 std::chrono::milliseconds ocsp_timeout = std::chrono::milliseconds(0),
319 const std::vector<std::optional<OCSP::Response>>& ocsp_resp = {});
320
321/**
322* PKIX Path Validation
323* @param end_cert certificate to validate
324* @param restrictions path validation restrictions
325* @param store store that contains trusted certificates
326* @param hostname if not empty, compared against the DNS name in end_cert
327* @param usage if not set to UNSPECIFIED, compared against the key usage in end_cert
328* @param validation_time what reference time to use for validation
329* @param ocsp_timeout timeout for OCSP operations, 0 disables OCSP check
330* @param ocsp_resp additional OCSP responses to consider (eg from peer)
331* @return result of the path validation
332*/
334 x509_path_validate(const X509_Certificate& end_cert,
335 const Path_Validation_Restrictions& restrictions,
336 const Certificate_Store& store,
337 std::string_view hostname = "",
339 std::chrono::system_clock::time_point validation_time = std::chrono::system_clock::now(),
340 std::chrono::milliseconds ocsp_timeout = std::chrono::milliseconds(0),
341 const std::vector<std::optional<OCSP::Response>>& ocsp_resp = {});
342
343/**
344* PKIX Path Validation
345* @param end_certs certificate chain to validate
346* @param restrictions path validation restrictions
347* @param store store that contains trusted certificates
348* @param hostname if not empty, compared against the DNS name in end_certs[0]
349* @param usage if not set to UNSPECIFIED, compared against the key usage in end_certs[0]
350* @param validation_time what reference time to use for validation
351* @param ocsp_timeout timeout for OCSP operations, 0 disables OCSP check
352* @param ocsp_resp additional OCSP responses to consider (eg from peer)
353* @return result of the path validation
354*/
356 x509_path_validate(const std::vector<X509_Certificate>& end_certs,
357 const Path_Validation_Restrictions& restrictions,
358 const Certificate_Store& store,
359 std::string_view hostname = "",
361 std::chrono::system_clock::time_point validation_time = std::chrono::system_clock::now(),
362 std::chrono::milliseconds ocsp_timeout = std::chrono::milliseconds(0),
363 const std::vector<std::optional<OCSP::Response>>& ocsp_resp = {});
364
365/**
366* namespace PKIX holds the building blocks that are called by x509_path_validate.
367* This allows custom validation logic to be written by applications and makes
368* for easier testing, but unless you're positive you know what you're doing you
369* probably want to just call x509_path_validate instead.
370*/
371namespace PKIX {
372
373/**
374* Create all certificate paths by identifying all possible routes from the
375* end-entity certificate to any certificate in the certificate store list. Paths
376* may also end in intermediate or leaf certificates found in the certificate
377* stores.
378*
379* WARNING: The validity (e.g. signatures or constraints) of the output path IS
380* NOT checked.
381*
382* @param cert_paths output parameter to be filled with all discovered certificate paths
383* @param trusted_certstores list of certificate stores that contain trusted certificates
384* @param end_entity the cert to be validated
385* @param end_entity_extra optional list of additional untrusted certs for path building
386* @param max_paths if set, enumerate at most this many paths and return
387* EXCEEDED_SEARCH_LIMITS if more paths exist; if nullopt, unbounded
388* @return result of the path building operation (OK or error)
389*/
391 build_all_certificate_paths(std::vector<std::vector<X509_Certificate>>& cert_paths,
392 const std::vector<Certificate_Store*>& trusted_certstores,
393 const X509_Certificate& end_entity,
394 const std::vector<X509_Certificate>& end_entity_extra,
395 std::optional<size_t> max_paths = std::nullopt);
396
397/**
398* Same as build_all_certificate_paths but only outputs a single path. If there are
399* paths ending in self-signed certificates, these are prioritized over paths ending
400* in intermediate or leaf certificates of the certificate store.
401*
402* WARNING: The validity (e.g. signatures or constraints) of the output path IS
403* NOT checked.
404*
405* @param cert_path_out output parameter, cert_path will be appended to this vector
406* @param trusted_certstores list of certificate stores that contain trusted certificates
407* @param end_entity the cert to be validated
408* @param end_entity_extra optional list of additional untrusted certs for path building
409* @param max_paths if set, examine at most this many candidate paths; if nullopt, unbounded
410* @return result of the path building operation (OK or error)
411*/
412BOTAN_DEPRECATED("Use build_all_certificate_paths")
414 build_certificate_path(std::vector<X509_Certificate>& cert_path_out,
415 const std::vector<Certificate_Store*>& trusted_certstores,
416 const X509_Certificate& end_entity,
417 const std::vector<X509_Certificate>& end_entity_extra,
418 std::optional<size_t> max_paths = std::nullopt);
419
420/**
421* Check the certificate chain, but not any revocation data
422*
423* @param cert_path path built by build_certificate_path with OK result.
424* The first element is the end entity certificate, the last element is
425* the trusted root certificate. The signature on the trusted root is
426* not verified; it is trusted because it was provided as a trust anchor.
427* @param ref_time whatever time you want to perform the validation
428* against (normally current system clock)
429* @param hostname the hostname
430* @param usage end entity usage checks
431* @param restrictions the relevant path validation restrictions object
432* @return vector of results on per certificate in the path, each containing a set of
433* results. If all codes in the set are < Certificate_Status_Code::FIRST_ERROR_STATUS,
434* then the result for that certificate is successful. If all results are
435*/
436CertificatePathStatusCodes BOTAN_PUBLIC_API(3, 0) check_chain(const std::vector<X509_Certificate>& cert_path,
437 std::chrono::system_clock::time_point ref_time,
438 std::string_view hostname,
439 Usage_Type usage,
440 const Path_Validation_Restrictions& restrictions);
441
442/**
443* Check OCSP responses for revocation information
444* @param cert_path path already validated by check_chain
445* @param ocsp_responses the OCSP responses to consider
446* @param certstores trusted roots
447* @param ref_time whatever time you want to perform the validation against
448* (normally current system clock)
449* @param restrictions the relevant path validation restrictions object
450* @return revocation status
451*/
453 check_ocsp(const std::vector<X509_Certificate>& cert_path,
454 const std::vector<std::optional<OCSP::Response>>& ocsp_responses,
455 const std::vector<Certificate_Store*>& certstores,
456 std::chrono::system_clock::time_point ref_time,
457 const Path_Validation_Restrictions& restrictions);
458
459/**
460* Check CRLs for revocation information
461* @param cert_path path already validated by check_chain
462* @param crls the list of CRLs to check, it is assumed that crls[i] (if not null)
463* is the associated CRL for the subject in cert_path[i].
464* @param ref_time whatever time you want to perform the validation against
465* (normally current system clock)
466* @param restrictions the relevant path validation restrictions object
467* @return revocation status
468*/
469CertificatePathStatusCodes BOTAN_PUBLIC_API(3, 14) check_crl(const std::vector<X509_Certificate>& cert_path,
470 const std::vector<std::optional<X509_CRL>>& crls,
471 std::chrono::system_clock::time_point ref_time,
472 const Path_Validation_Restrictions& restrictions);
473
474/**
475* Check CRLs for revocation information
476*
477* Equivalent to calling check_crl with a default Path_Validation_Restrictions
478*/
479BOTAN_DEPRECATED("Use overload taking Path_Validation_Restrictions")
480CertificatePathStatusCodes BOTAN_PUBLIC_API(2, 0) check_crl(const std::vector<X509_Certificate>& cert_path,
481 const std::vector<std::optional<X509_CRL>>& crls,
482 std::chrono::system_clock::time_point ref_time);
483
484/**
485* Check CRLs for revocation information
486* @param cert_path path already validated by check_chain
487* @param certstores a list of certificate stores to query for the CRL
488* @param ref_time whatever time you want to perform the validation against
489* (normally current system clock)
490* @param restrictions the relevant path validation restrictions object
491* @return revocation status
492*/
493CertificatePathStatusCodes BOTAN_PUBLIC_API(3, 14) check_crl(const std::vector<X509_Certificate>& cert_path,
494 const std::vector<Certificate_Store*>& certstores,
495 std::chrono::system_clock::time_point ref_time,
496 const Path_Validation_Restrictions& restrictions);
497
498/**
499* Check CRLs for revocation information
500*
501* Equivalent to calling check_crl with a default Path_Validation_Restrictions
502*/
503BOTAN_DEPRECATED("Use overload taking Path_Validation_Restrictions")
504CertificatePathStatusCodes BOTAN_PUBLIC_API(2, 0) check_crl(const std::vector<X509_Certificate>& cert_path,
505 const std::vector<Certificate_Store*>& certstores,
506 std::chrono::system_clock::time_point ref_time);
507
508#if defined(BOTAN_HAS_ONLINE_REVOCATION_CHECKS)
509
510/**
511* Check OCSP using online (HTTP) access. Current version creates a thread and
512* network connection per OCSP request made.
513*
514* @param cert_path path already validated by check_chain
515* @param trusted_certstores a list of certstores with trusted certs
516* @param ref_time whatever time you want to perform the validation against
517* (normally current system clock)
518* @param timeout for timing out the responses, though actually this function
519* may block for up to timeout*cert_path.size()*C for some small C.
520* @param restrictions the relevant path validation restrictions object
521* @return revocation status
522*/
524 check_ocsp_online(const std::vector<X509_Certificate>& cert_path,
525 const std::vector<Certificate_Store*>& trusted_certstores,
526 std::chrono::system_clock::time_point ref_time,
527 std::chrono::milliseconds timeout,
528 const Path_Validation_Restrictions& restrictions);
529
530/**
531* Check CRL using online (HTTP) access. Current version creates a thread and
532* network connection per CRL access.
533
534* @param cert_path path already validated by check_chain
535* @param trusted_certstores a list of certstores with trusted certs
536* @param certstore_to_recv_crls optional (nullptr to disable), all CRLs
537* retrieved will be saved to this cert store.
538* @param ref_time whatever time you want to perform the validation against
539* (normally current system clock)
540* @param timeout for timing out the responses, though actually this function
541* may block for up to timeout*cert_path.size()*C for some small C.
542* @param restrictions the relevant path validation restrictions object
543* @return revocation status
544*/
546 check_crl_online(const std::vector<X509_Certificate>& cert_path,
547 const std::vector<Certificate_Store*>& trusted_certstores,
548 Certificate_Store_In_Memory* certstore_to_recv_crls,
549 std::chrono::system_clock::time_point ref_time,
550 std::chrono::milliseconds timeout,
551 const Path_Validation_Restrictions& restrictions);
552
553/**
554* Check CRL using online (HTTP) access.
555*
556* Equivalent to calling check_crl_online with a default Path_Validation_Restrictions
557*/
558BOTAN_DEPRECATED("Use overload taking Path_Validation_Restrictions")
560 check_crl_online(const std::vector<X509_Certificate>& cert_path,
561 const std::vector<Certificate_Store*>& trusted_certstores,
562 Certificate_Store_In_Memory* certstore_to_recv_crls,
563 std::chrono::system_clock::time_point ref_time,
564 std::chrono::milliseconds timeout);
565
566#endif
567
568/**
569* Find overall status (OK, error) of a validation
570* @param cert_status result of merge_revocation_status or check_chain
571*/
573
574/**
575* Merge the results from CRL and/or OCSP checks into chain_status
576* @param chain_status the certificate status
577* @param crl_status results from check_crl
578* @param ocsp_status results from check_ocsp
579* @param restrictions the relevant path validation restrictions object
580*/
582 const CertificatePathStatusCodes& crl_status,
583 const CertificatePathStatusCodes& ocsp_status,
584 const Path_Validation_Restrictions& restrictions);
585
586} // namespace PKIX
587
588} // namespace Botan
589
590#endif
#define BOTAN_PUBLIC_API(maj, min)
Definition api.h:21
#define BOTAN_DEPRECATED(msg)
Definition api.h:73
#define BOTAN_FUTURE_EXPLICIT
Definition api.h:52
BOTAN_FUTURE_EXPLICIT Path_Validation_Restrictions(bool require_rev=false, size_t minimum_key_strength=110, bool ocsp_all_intermediates=false, std::chrono::seconds max_ocsp_age=std::chrono::hours(24 *7), std::unique_ptr< Certificate_Store > trusted_ocsp_responders=nullptr, bool ignore_trusted_root_time_range=false, bool require_self_signed_trust_anchors=true, bool accept_ocsp_softfail=false)
bool require_revocation_information() const
Definition x509path.h:123
const std::set< std::string > & trusted_hashes() const
Definition x509path.h:134
std::chrono::seconds max_ocsp_age() const
Definition x509path.h:145
bool ignore_trusted_root_time_range() const
Definition x509path.h:165
bool require_self_signed_trust_anchors() const
Definition x509path.h:175
Path_Validation_Restrictions(bool require_rev, size_t minimum_key_strength, bool ocsp_all_intermediates, const std::set< std::string > &trusted_hashes, std::chrono::seconds max_ocsp_age=std::chrono::hours(24 *7), std::unique_ptr< Certificate_Store > trusted_ocsp_responders=nullptr, bool ignore_trusted_root_time_range=false, bool require_self_signed_trust_anchors=true, bool accept_ocsp_softfail=false)
Definition x509path.h:101
const Certificate_Store * trusted_ocsp_responders() const
Definition x509path.h:152
Certificate_Status_Code result() const
Definition x509path.h:229
Certificate_Status_Code Code
Definition x509path.h:202
Path_Validation_Result(Certificate_Status_Code status)
Definition x509path.h:268
const std::vector< X509_Certificate > & cert_path() const
Definition x509path.h:214
Path_Validation_Result(CertificatePathStatusCodes status, std::vector< X509_Certificate > &&cert_chain)
const X509_Certificate & trust_root() const
const CertificatePathStatusCodes & all_statuses() const
Definition x509path.h:234
void merge_revocation_status(CertificatePathStatusCodes &chain_status, const CertificatePathStatusCodes &crl_status, const CertificatePathStatusCodes &ocsp_status, const Path_Validation_Restrictions &restrictions)
Certificate_Status_Code build_certificate_path(std::vector< X509_Certificate > &cert_path_out, const std::vector< Certificate_Store * > &trusted_certstores, const X509_Certificate &end_entity, const std::vector< X509_Certificate > &end_entity_extra, std::optional< size_t > max_paths=std::nullopt)
CertificatePathStatusCodes check_crl(const std::vector< X509_Certificate > &cert_path, const std::vector< std::optional< X509_CRL > > &crls, std::chrono::system_clock::time_point ref_time, const Path_Validation_Restrictions &restrictions)
Definition x509path.cpp:744
Certificate_Status_Code build_all_certificate_paths(std::vector< std::vector< X509_Certificate > > &cert_paths, const std::vector< Certificate_Store * > &trusted_certstores, const X509_Certificate &end_entity, const std::vector< X509_Certificate > &end_entity_extra, std::optional< size_t > max_paths=std::nullopt)
Certificate_Status_Code overall_status(const CertificatePathStatusCodes &cert_status)
CertificatePathStatusCodes check_ocsp(const std::vector< X509_Certificate > &cert_path, const std::vector< std::optional< OCSP::Response > > &ocsp_responses, const std::vector< Certificate_Store * > &certstores, std::chrono::system_clock::time_point ref_time, const Path_Validation_Restrictions &restrictions)
Definition x509path.cpp:705
CertificatePathStatusCodes check_chain(const std::vector< X509_Certificate > &cert_path, std::chrono::system_clock::time_point ref_time, std::string_view hostname, Usage_Type usage, const Path_Validation_Restrictions &restrictions)
Definition x509path.cpp:344
std::vector< std::set< Certificate_Status_Code > > CertificatePathStatusCodes
Definition x509path.h:29
Certificate_Status_Code
Definition pkix_enums.h:21
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)