Type Alias AlgorithmIdentifierRef

Source
pub type AlgorithmIdentifierRef<'a> = AlgorithmIdentifier<AnyRef<'a>>;
Expand description

AlgorithmIdentifier reference which has AnyRef parameters.

Aliased Type§

struct AlgorithmIdentifierRef<'a> {
    pub oid: ObjectIdentifier,
    pub parameters: Option<AnyRef<'a>>,
}

Fields§

§oid: ObjectIdentifier

Algorithm OID, i.e. the algorithm field in the AlgorithmIdentifier ASN.1 schema.

§parameters: Option<AnyRef<'a>>

Algorithm parameters.

Implementations§

Source§

impl<'a> AlgorithmIdentifierRef<'a>

Source

pub fn assert_parameters_oid( &self, expected_oid: ObjectIdentifier, ) -> Result<ObjectIdentifier>

Assert parameters is an OID and has the expected value.

Source

pub fn assert_oids( &self, algorithm: ObjectIdentifier, parameters: ObjectIdentifier, ) -> Result<()>

Assert the values of the algorithm and parameters OIDs.

Source

pub fn parameters_any(&self) -> Result<AnyRef<'a>>

Get the parameters field as an AnyRef.

Returns an error if parameters are None.

Source

pub fn parameters_oid(&self) -> Result<ObjectIdentifier>

Get the parameters field as an ObjectIdentifier.

Returns an error if it is absent or not an OID.

Source

pub fn oids(&self) -> Result<(ObjectIdentifier, Option<ObjectIdentifier>)>

Convert to a pair of ObjectIdentifiers.

This method is helpful for decomposing in match statements. Note in particular that NULL parameters are treated the same as missing parameters.

Returns an error if parameters are present but not an OID.

Source§

impl<Params> AlgorithmIdentifier<Params>

Source

pub fn assert_algorithm_oid( &self, expected_oid: ObjectIdentifier, ) -> Result<ObjectIdentifier>

Assert the algorithm OID is an expected value.

Trait Implementations§

Source§

impl<'a> RefToOwned<'a> for AlgorithmIdentifierRef<'a>

Source§

type Owned = AlgorithmIdentifier<Any>

The resulting type after obtaining ownership.
Source§

fn ref_to_owned(&self) -> Self::Owned

Creates a new object taking ownership of the data
Source§

impl<Params: Clone> Clone for AlgorithmIdentifier<Params>

Source§

fn clone(&self) -> AlgorithmIdentifier<Params>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Params: Debug> Debug for AlgorithmIdentifier<Params>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, Params> DecodeValue<'a> for AlgorithmIdentifier<Params>
where Params: Choice<'a>,

Source§

fn decode_value<R: Reader<'a>>(reader: &mut R, header: Header) -> Result<Self>

Attempt to decode this message using the provided Reader.
Source§

impl<Params> EncodeValue for AlgorithmIdentifier<Params>
where Params: Encode,

Source§

fn value_len(&self) -> Result<Length>

Compute the length of this value (sans [Tag]+Length header) when encoded as ASN.1 DER.
Source§

fn encode_value(&self, writer: &mut impl Writer) -> Result<()>

Encode value (sans [Tag]+Length header) as ASN.1 DER using the provided Writer.
Source§

fn header(&self) -> Result<Header, Error>
where Self: Tagged,

Get the Header used to encode this value.
Source§

impl<Params: Ord> Ord for AlgorithmIdentifier<Params>

Source§

fn cmp(&self, other: &AlgorithmIdentifier<Params>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<Params: PartialEq> PartialEq for AlgorithmIdentifier<Params>

Source§

fn eq(&self, other: &AlgorithmIdentifier<Params>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Params: PartialOrd> PartialOrd for AlgorithmIdentifier<Params>

Source§

fn partial_cmp(&self, other: &AlgorithmIdentifier<Params>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, Params> TryFrom<&'a [u8]> for AlgorithmIdentifier<Params>
where Params: Choice<'a> + Encode,

Source§

type Error = Error

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

fn try_from(bytes: &'a [u8]) -> Result<Self>

Performs the conversion.
Source§

impl<Params> ValueOrd for AlgorithmIdentifier<Params>
where Params: DerOrd,

Source§

fn value_cmp(&self, other: &Self) -> Result<Ordering>

Return an Ordering between value portion of TLV-encoded self and other when serialized as ASN.1 DER.
Source§

impl<Params: Copy> Copy for AlgorithmIdentifier<Params>

Source§

impl<Params: Eq> Eq for AlgorithmIdentifier<Params>

Source§

impl<'a, Params> Sequence<'a> for AlgorithmIdentifier<Params>
where Params: Choice<'a> + Encode,

Source§

impl<Params> StructuralPartialEq for AlgorithmIdentifier<Params>