pub struct ValidationPolicy {
pub max_path_len: u8,
pub current_time_unix: u64,
pub enforce_key_usage: bool,
}Expand description
Policy parameters controlling path validation.
§Limitations
v0.1 does not enforce NameConstraints, CertificatePolicies, or PolicyMappings. Fields for these will be added in v0.2.
Fields§
§max_path_len: u8Maximum chain depth, not counting the trust anchor. Default: 10.
A chain of [leaf] is depth 0. [leaf, intermediate, root] is depth 1
(one intermediate). Validation fails if depth exceeds this value.
current_time_unix: u64Current time as seconds since the Unix epoch (1970-01-01T00:00:00Z).
Used to check notBefore ≤ now ≤ notAfter on every certificate.
Must be set by the caller — there is no platform clock in no_std.
Warning — the default is 0 (1970-01-01): Any certificate issued
after 1970 has notBefore > 0 and will fail the validity check with
Error::ValidityPeriod. If you see unexpected ValidityPeriod
errors, check that current_time_unix is set to the current time.
Warning: passing u64::MAX causes all notAfter checks to pass.
This effectively disables expiry checking — only use it in contexts
where you explicitly want permissive (clock-free) validation.
enforce_key_usage: boolEnforce the KeyUsage extension when present. Default: true.
When true, an intermediate certificate missing keyCertSign in its
KeyUsage will be rejected even if BasicConstraints cA=TRUE.
Implementations§
Source§impl ValidationPolicy
impl ValidationPolicy
Sourcepub fn new(now_unix: u64) -> Self
pub fn new(now_unix: u64) -> Self
Construct a policy with the given time and sensible defaults.
Equivalent to ValidationPolicy { current_time_unix: now_unix, ..Default::default() }.
This is the preferred constructor: it forces the caller to supply a timestamp,
preventing the silent validity failures caused by Default’s current_time_unix = 0.
Trait Implementations§
Source§impl Clone for ValidationPolicy
impl Clone for ValidationPolicy
Source§fn clone(&self) -> ValidationPolicy
fn clone(&self) -> ValidationPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more