1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use fmt;
use crateOid;
use crateUnverifiedCertificateChain;
/// The result of evaluating a [`ValidationPolicy`] against a candidate certificate chain.
///
/// `Ok(())` means the chain meets the policy requirements; `Err(reason)` means the chain
/// fails to meet the policy requirements, with the associated reason.
pub type PolicyEvaluationResult = ;
/// Why a chain was rejected by policy evaluation.
;
/// A [`ValidationPolicy`] implements a series of checks on an [`UnverifiedCertificateChain`] to determine
/// whether that chain should be trusted.
///
/// Certificate verification is split into two parts: chain building and policy enforcement. Chain building is general:
/// regardless of policy, we use the same chain building algorithm. This will generate a sequence of candidate chains in
/// the form of [`UnverifiedCertificateChain`].
///
/// Each of these candidate chains is then handed to a [`ValidationPolicy`] to be checked against the certificate policy.
/// The reason for this is to allow different use cases to share the same chain building code, but to enforce
/// different requirements on the chain.
///
/// Some [`ValidationPolicy`] objects are used frequently and are very common, such as `RFC5280Policy` which implements
/// the basic checks from that RFC. Other objects are less common, such as an OCSP policy, which performs live
/// revocation checking. Users can also implement their own policies to enable this crate to support other
/// use cases.