pub struct AlgorithmIdentifier<'a> { /* private fields */ }Expand description
An algorithm and its parameters, as the certificate wrote them.
Implementations§
Source§impl<'a> AlgorithmIdentifier<'a>
impl<'a> AlgorithmIdentifier<'a>
Sourcepub fn parameters(self) -> Option<&'a [u8]>
pub fn parameters(self) -> Option<&'a [u8]>
The parameters, as the whole encoded element, or None where the
certificate wrote none.
Kept encoded because what they mean depends on the algorithm: the same bytes are a curve for one and a hash function and salt length for another.
Sourcepub fn has_no_parameters(self) -> bool
pub fn has_no_parameters(self) -> bool
Whether the parameters are absent, or the null that means the same thing for the algorithms that spell it that way.
Sourcepub fn matches(
self,
other: &AlgorithmIdentifier<'_>,
execution: &Memory,
) -> Result<bool>
pub fn matches( self, other: &AlgorithmIdentifier<'_>, execution: &Memory, ) -> Result<bool>
Whether two identifiers name the same algorithm with the same parameters.
An absent parameter and an explicit null are treated as the same, and nothing else is. Issuers disagree about which of the two to write for the algorithms that take no parameters, and both say the same thing; any other difference changes what is being verified.
The equivalence is deliberately not algorithm-specific. Which parameter encodings an algorithm permits at all, including that the Edwards-curve identifiers forbid the null form, is the algorithm registry’s decision, made against the identifier inside the signed bytes. This comparison only asks whether the unsigned outer identifier agrees with that signed one, and absent versus null cannot change which algorithm that is: an outer null beside a signed absent is a malformed spelling of the same identity, not a different algorithm escaping the mismatch check.
Deferred comparisons charge the supplied current operation. Their
resource diagnostics identify self’s original field and offset; they
do not assert that the two identifiers share a source. Parser-local
limits apply only when comparing through the producing reader.
§Errors
Returns a resource refusal before an unfunded byte comparison.
§Examples
let identifier = structured_pkix::algorithm::read(&reader, &element, "algorithm")?;
assert!(identifier.matches(&identifier, &execution)?);