Skip to main content

AlgorithmIdentifier

Struct AlgorithmIdentifier 

Source
pub struct AlgorithmIdentifier<'a> { /* private fields */ }
Expand description

An algorithm and its parameters, as the certificate wrote them.

Implementations§

Source§

impl<'a> AlgorithmIdentifier<'a>

Source

pub fn algorithm(self) -> Oid<'a>

Which algorithm.

Source

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.

Source

pub fn as_bytes(self) -> &'a [u8] ⓘ

The whole identifier as it was encoded.

Source

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.

Source

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)?);

Trait Implementations§

Source§

impl<'a> Clone for AlgorithmIdentifier<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for AlgorithmIdentifier<'a>

Source§

impl<'a> Debug for AlgorithmIdentifier<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.