#[non_exhaustive]pub enum DnAttrRule {
Field(ObjectIdentifier),
AllOf(Vec<DnAttrRule>),
AnyOf(Vec<DnAttrRule>),
}Expand description
Compositional rule for asserting required Subject DN attributes on a leaf cert.
Designed to express CA/B Forum S/MIME BR tier rules such as “must have
organizationName” or “must have pseudonym OR (givenName AND
surname)” without committing the workspace to a fixed list of attribute
requirements.
The Field variant matches when the named OID appears at
least once in the leaf’s Subject DN RDN sequence (any RDN, any
AttributeTypeAndValue within an RDN). AllOf and
AnyOf compose subordinate rules.
§Vacuity
AllOf(vec![])accepts every Subject DN (vacuously true).AnyOf(vec![])rejects every Subject DN (vacuously false).
Callers writing AnyOf should not pass an empty list unless that is the
intended semantics.
§Example
Express “Subject must have pseudonym, or both givenName and
surname”:
use pkix_path::DnAttrRule;
use der::asn1::ObjectIdentifier;
const PSEUDONYM: ObjectIdentifier = ObjectIdentifier::new_unwrap("2.5.4.65");
const GIVEN_NAME: ObjectIdentifier = ObjectIdentifier::new_unwrap("2.5.4.42");
const SURNAME: ObjectIdentifier = ObjectIdentifier::new_unwrap("2.5.4.4");
let rule = DnAttrRule::AnyOf(vec![
DnAttrRule::Field(PSEUDONYM),
DnAttrRule::AllOf(vec![
DnAttrRule::Field(GIVEN_NAME),
DnAttrRule::Field(SURNAME),
]),
]);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Field(ObjectIdentifier)
Match when the named attribute OID appears at least once in the leaf’s Subject DN.
AllOf(Vec<DnAttrRule>)
Match when every subordinate rule matches. AllOf(vec![]) is
vacuously true.
AnyOf(Vec<DnAttrRule>)
Match when at least one subordinate rule matches. AnyOf(vec![])
is vacuously false.
Trait Implementations§
Source§impl Clone for DnAttrRule
impl Clone for DnAttrRule
Source§fn clone(&self) -> DnAttrRule
fn clone(&self) -> DnAttrRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DnAttrRule
impl Debug for DnAttrRule
Source§impl<'de> Deserialize<'de> for DnAttrRule
impl<'de> Deserialize<'de> for DnAttrRule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DnAttrRule
Source§impl PartialEq for DnAttrRule
impl PartialEq for DnAttrRule
Source§fn eq(&self, other: &DnAttrRule) -> bool
fn eq(&self, other: &DnAttrRule) -> bool
self and other values to be equal, and is used by ==.