pub struct Path { /* private fields */ }
Expand description
A path in a Network.
A path is a sequence of Certification
s where the target of a
certification is the issuer of the next certification. Path
s
are built up gradually using Path::try_append
. As such, a
Path
may just be a path prefix. For this reason, the regular
expression constraint is not enforced. However, the Path
implementation does guarantee that the target of a certification
is the issuer of the next certification in the path.
Implementations§
Source§impl Path
impl Path
Sourcepub fn new<C>(root: C) -> Selfwhere
C: Into<CertSynopsis>,
pub fn new<C>(root: C) -> Selfwhere
C: Into<CertSynopsis>,
Instantiates a path starting at the specified root.
We assume that the root is ultimately trusted (its trust depth is unlimited and its trust amount is maximal).
Sourcepub fn set_certification_network(&mut self, certification_network: bool)
pub fn set_certification_network(&mut self, certification_network: bool)
Controls how path validity is determined.
In a certification network, trust depth and regular expressions are ignored and a certification isn’t just used to validate a binding, but also to designate the target certificate as a trusted introducer.
Sourcepub fn certification_network(&self) -> bool
pub fn certification_network(&self) -> bool
Returns how path validity is determined.
In a certification network, trust depth and regular expressions are ignored and a certification isn’t just used to validate a binding, but also to designate the target certificate as a trusted introducer.
Sourcepub fn root(&self) -> &CertSynopsis
pub fn root(&self) -> &CertSynopsis
Returns the path’s root.
Sourcepub fn target(&self) -> &CertSynopsis
pub fn target(&self) -> &CertSynopsis
Returns the last node in the path.
Sourcepub fn certificates(
&self,
) -> impl Iterator<Item = &CertSynopsis> + DoubleEndedIterator
pub fn certificates( &self, ) -> impl Iterator<Item = &CertSynopsis> + DoubleEndedIterator
Returns an iterator over the path’s certificates (the nodes).
The certificates are returned from the root towards the target.
Sourcepub fn certifications(&self) -> impl Iterator<Item = &Certification>
pub fn certifications(&self) -> impl Iterator<Item = &Certification>
Returns the certifications.
The certifications are returned from the root towards the target.
Sourcepub fn residual_depth(&self) -> Depth
pub fn residual_depth(&self) -> Depth
Returns the residual trust depth.
The residual trust depth is calculated by taking the trust depth of root and reducing it by one for each certification in the path. If passing a certification with a lower trust depth than the current trust value, the lower value is used from that point on.
Sourcepub fn amount(&self) -> usize
pub fn amount(&self) -> usize
Returns the amount that the target is trusted.
120 usually means fully trusted. This function checks that each certification’s depth parameter is sufficient for the rest of the path. It does not check any regular expressions, as the regular expressions only apply to the User ID being authenticated, and that may not yet have been added to the path (i.e., the path may be a path prefix).
Sourcepub fn append(&mut self, certification: Certification) -> Result<()>
pub fn append(&mut self, certification: Certification) -> Result<()>
Appends the certification to the path.
This checks that the target of the last certification is the
issuer of the new certification, but it does not check the
depth constraints, nor does it check for cycles. To ensure
that the path is a valid path prefix, use Path::try_append
instead.
Sourcepub fn try_append(&mut self, certification: Certification) -> Result<()>
pub fn try_append(&mut self, certification: Certification) -> Result<()>
Appends the certification to the path if the path allows it.
This will fail if the trust depth is insufficient, or adding the certificate would induce a cycle. This function does not check any regular expressions, as the regular expressions only apply to the User ID being authenticated, and that may not yet have been added to the path (i.e., the path may be a path prefix).
Sourcepub fn self_signature(&self) -> bool
pub fn self_signature(&self) -> bool
Returns whether the path describes a self signature.