pub struct AlgorithmIdentifier<Params> {
pub oid: ObjectIdentifier,
pub parameters: Option<Params>,
}pkcs8 only.Expand description
X.509 AlgorithmIdentifier as defined in RFC 5280 Section 4.1.1.2.
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL }Fields§
§oid: ObjectIdentifierAlgorithm OID, i.e. the algorithm field in the AlgorithmIdentifier
ASN.1 schema.
parameters: Option<Params>Algorithm parameters.
Implementations§
Source§impl<Params> AlgorithmIdentifier<Params>
impl<Params> AlgorithmIdentifier<Params>
Sourcepub fn assert_algorithm_oid(
&self,
expected_oid: ObjectIdentifier,
) -> Result<ObjectIdentifier, Error>
pub fn assert_algorithm_oid( &self, expected_oid: ObjectIdentifier, ) -> Result<ObjectIdentifier, Error>
Assert the algorithm OID is an expected value.
§Errors
Returns Error::OidUnknown if self does not match expected_oid.
Source§impl<'a> AlgorithmIdentifier<AnyRef<'a>>
impl<'a> AlgorithmIdentifier<AnyRef<'a>>
Sourcepub fn assert_parameters_oid(
&self,
expected_oid: ObjectIdentifier,
) -> Result<ObjectIdentifier, Error>
pub fn assert_parameters_oid( &self, expected_oid: ObjectIdentifier, ) -> Result<ObjectIdentifier, Error>
Assert parameters is an OID and has the expected value.
§Errors
Returns Error::OidUnknown if self.parameters_oid() doesn’t match expected_oid.
Sourcepub fn assert_oids(
&self,
algorithm: ObjectIdentifier,
parameters: ObjectIdentifier,
) -> Result<(), Error>
pub fn assert_oids( &self, algorithm: ObjectIdentifier, parameters: ObjectIdentifier, ) -> Result<(), Error>
Assert the values of the algorithm and parameters OIDs.
§Errors
Returns Error::OidUnknown if algorithm and/or parameters aren’t the expected values.
Sourcepub fn parameters_any(&self) -> Result<AnyRef<'a>, Error>
pub fn parameters_any(&self) -> Result<AnyRef<'a>, Error>
Get the parameters field as an AnyRef.
§Errors
Returns Error::AlgorithmParametersMissing error if self.parameters are None.
Sourcepub fn parameters_oid(&self) -> Result<ObjectIdentifier, Error>
pub fn parameters_oid(&self) -> Result<ObjectIdentifier, Error>
Get the parameters field as an ObjectIdentifier.
§Errors
- Returns
Error::AlgorithmParametersMissingerror ifself.parametersareNone. - Returns
Error::Asn1ifself.parametersis not an OID.
Sourcepub fn oids(
&self,
) -> Result<(ObjectIdentifier, Option<ObjectIdentifier>), Error>
pub fn oids( &self, ) -> Result<(ObjectIdentifier, Option<ObjectIdentifier>), Error>
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.
§Errors
Returns an error if parameters are present but not an OID.
Trait Implementations§
Source§impl<Params> Clone for AlgorithmIdentifier<Params>where
Params: Clone,
impl<Params> Clone for AlgorithmIdentifier<Params>where
Params: Clone,
Source§fn clone(&self) -> AlgorithmIdentifier<Params>
fn clone(&self) -> AlgorithmIdentifier<Params>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Params> Debug for AlgorithmIdentifier<Params>where
Params: Debug,
impl<Params> Debug for AlgorithmIdentifier<Params>where
Params: Debug,
Source§impl<'a, Params> DecodeValue<'a> for AlgorithmIdentifier<Params>
impl<'a, Params> DecodeValue<'a> for AlgorithmIdentifier<Params>
Source§impl<Params> EncodeValue for AlgorithmIdentifier<Params>where
Params: Encode,
impl<Params> EncodeValue for AlgorithmIdentifier<Params>where
Params: Encode,
Source§impl<Params> Hash for AlgorithmIdentifier<Params>where
Params: Hash,
impl<Params> Hash for AlgorithmIdentifier<Params>where
Params: Hash,
Source§impl<Params> Ord for AlgorithmIdentifier<Params>where
Params: Ord,
impl<Params> Ord for AlgorithmIdentifier<Params>where
Params: Ord,
Source§fn cmp(&self, other: &AlgorithmIdentifier<Params>) -> Ordering
fn cmp(&self, other: &AlgorithmIdentifier<Params>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl OwnedToRef for AlgorithmIdentifier<Any>
impl OwnedToRef for AlgorithmIdentifier<Any>
Source§type Borrowed<'a> = AlgorithmIdentifier<AnyRef<'a>>
type Borrowed<'a> = AlgorithmIdentifier<AnyRef<'a>>
Source§fn owned_to_ref(&self) -> <AlgorithmIdentifier<Any> as OwnedToRef>::Borrowed<'_>
fn owned_to_ref(&self) -> <AlgorithmIdentifier<Any> as OwnedToRef>::Borrowed<'_>
Source§impl<Params> PartialEq for AlgorithmIdentifier<Params>where
Params: PartialEq,
impl<Params> PartialEq for AlgorithmIdentifier<Params>where
Params: PartialEq,
Source§fn eq(&self, other: &AlgorithmIdentifier<Params>) -> bool
fn eq(&self, other: &AlgorithmIdentifier<Params>) -> bool
self and other values to be equal, and is used by ==.