#[non_exhaustive]pub struct PolicyTreeNode {
pub depth: usize,
pub valid_policy: ObjectIdentifier,
pub expected_policy_set: Vec<ObjectIdentifier>,
pub qualifiers: Vec<PolicyQualifierInfo>,
pub parent_policies: Vec<ObjectIdentifier>,
}Expand description
A node of the final policy graph, exposed for post-validation qualifier
extraction on ValidatedPath::valid_policy_tree.
Policy processing uses the RFC 9618 valid_policy_graph in place of the
RFC 5280 §6.1.2(a) valid_policy_tree: there is at most one node per
(depth, valid_policy), and a node that the RFC 5280 tree would copy
once per parent appears once, listing every parent in
parent_policies. The set of valid policies is
the same (RFC 9618 §3); the graph’s size stays linear in the size of the
path’s policy extensions, where the tree can grow exponentially.
This is the public mirror of an internal node type, kept separate so the internal representation is not part of the public API surface.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.depth: usizeDepth at which this node appears in the tree.
0 is the synthetic anyPolicy root sentinel (always present
while the tree is alive; carries no qualifiers). 1 is the
trust-anchor-adjacent CA. n is the leaf.
valid_policy: ObjectIdentifierThe policy OID this node represents.
May be id-ce-certificatePolicies-anyPolicy (2.5.29.32.0) for
nodes that survived an anyPolicy expansion or were not yet
materialized into specific policies.
expected_policy_set: Vec<ObjectIdentifier>Set of policies in the next certificate that are consistent with
this node, per RFC 5280 §6.1.2(a) expected_policy_set.
Initialized to {valid_policy} and updated by PolicyMappings
extensions during the walk.
qualifiers: Vec<PolicyQualifierInfo>Policy qualifiers attached to this node, in the upstream
PolicyQualifierInfo form: a (policy_qualifier_id, qualifier)
pair where qualifier is a raw der::Any. The two standard
qualifier IDs are id-qt-cps (1.3.6.1.5.5.7.2.1, qualifier is a
CPSuri / IA5String) and id-qt-unotice (1.3.6.1.5.5.7.2.2,
qualifier is a UserNotice).
§Why the qualifier is passed through undecoded
x509_cert::ext::pkix::certpolicy cannot decode two of the shapes
RFC 5280 §4.2.1.4 defines, as of x509-cert 0.3.1:
UserNotice::notice_refis declaredOption<GeneralizedTime>. RFC 5280 saysNoticeReference, which is aSEQUENCEof aDisplayTextand aSEQUENCE OF INTEGER. The crate definesNoticeReferencecorrectly in the same module and never uses it, so aUserNoticethat actually carries anoticeReffails to decode.DisplayTextimplements only theia5Stringandutf8Stringalternatives of a four-way CHOICE;visibleStringandbmpStringare absent, and the type’s own documentation says so.derhas carriedTag::VisibleStringandTag::BmpStringsince RustCrypto/formats#160, so the tags are available.
The second defect became the more consequential one with RFC 6818
§3, which replaced §4.2.1.4’s encoding guidance: visibleString
and bmpString went from MUST NOT to “acceptable but less
preferred”, and ia5String went from MAY to MUST NOT. So the
upstream DisplayText now decodes exactly the one encoding the
profile prohibits and neither of the two it newly permits.
Passing the Any through costs a caller the decode and keeps both
defects out of this crate’s results. rfc5280.cert.policies.explicit_text_encoding
reads the DisplayText tag directly for the same reason.
An earlier version of this comment called the first defect a
“typo on notice_ref” and cited
github.com/RustCrypto/formats/issues/x509-cert, which is not an
issue URL. No upstream issue exists for either defect; searching
RustCrypto/formats for UserNotice and NoticeReference returns
nothing.
parent_policies: Vec<ObjectIdentifier>valid_policy of each parent node at depth - 1 (nodes are unique
per depth, so the OID identifies the parent). Empty for the depth-0
root. A node’s parents are either exactly [anyPolicy] or a set of
specific policies.
Trait Implementations§
Source§impl Clone for PolicyTreeNode
impl Clone for PolicyTreeNode
Source§impl Debug for PolicyTreeNode
impl Debug for PolicyTreeNode
Source§impl<'de> Deserialize<'de> for PolicyTreeNode
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PolicyTreeNode
serde only.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 PolicyTreeNode
Source§impl PartialEq for PolicyTreeNode
impl PartialEq for PolicyTreeNode
Source§impl Serialize for PolicyTreeNode
Available on crate feature serde only.
impl Serialize for PolicyTreeNode
serde only.