Type Alias ApplicationExplicit

Source
pub type ApplicationExplicit<T, E, const TAG: u32> = TaggedValue<T, E, Explicit, asn1_rs::::asn1_types::tagged::application::ApplicationExplicit::{constant#0}, TAG>;
Available on crate feature mtls only.
Expand description

A helper object to parse [APPLICATION n] EXPLICIT T

A helper object implementing FromBer and FromDer, to parse explicit application-tagged values.

§Examples

To parse a [APPLICATION 0] EXPLICIT INTEGER object:

use asn1_rs::{ApplicationExplicit, Error, FromBer, Integer, TaggedValue};

let bytes = &[0x60, 0x03, 0x2, 0x1, 0x2];

// If tagged object is present (and has expected tag), parsing succeeds:
let (_, tagged) = ApplicationExplicit::<Integer, Error, 0>::from_ber(bytes).unwrap();
assert_eq!(tagged, TaggedValue::explicit(Integer::from(2)));

Aliased Type§

struct ApplicationExplicit<T, E, const TAG: u32> { /* private fields */ }

Implementations

Source§

impl<T, E, const CLASS: u8, const TAG: u32> TaggedValue<T, E, Explicit, CLASS, TAG>

Source

pub const fn explicit(inner: T) -> TaggedValue<T, E, Explicit, CLASS, TAG>

Constructs a new EXPLICIT TaggedParser with the provided value

Source§

impl<T, E, TagKind, const CLASS: u8, const TAG: u32> TaggedValue<T, E, TagKind, CLASS, TAG>

Source

pub fn into_inner(self) -> T

Consumes the TaggedParser, returning the wrapped value.

Source

pub const fn tag(&self) -> Tag

Return the (outer) tag of this object

Source

pub const fn class(&self) -> u8

Return the (outer) class of this object

Trait Implementations

Source§

impl<T, E, TagKind, const CLASS: u8, const TAG: u32> AsRef<T> for TaggedValue<T, E, TagKind, CLASS, TAG>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T, E, const CLASS: u8, const TAG: u32> CheckDerConstraints for TaggedValue<T, E, Explicit, CLASS, TAG>

Source§

impl<T, E, TagKind, const CLASS: u8, const TAG: u32> Debug for TaggedValue<T, E, TagKind, CLASS, TAG>
where T: Debug, E: Debug, TagKind: Debug,

Source§

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

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

impl<'a, T, E, const CLASS: u8, const TAG: u32> FromDer<'a, E> for TaggedValue<T, E, Explicit, CLASS, TAG>
where T: FromDer<'a, E>, E: From<Error>,

Source§

fn from_der( bytes: &'a [u8], ) -> Result<(&'a [u8], TaggedValue<T, E, Explicit, CLASS, TAG>), Err<E>>

Attempt to parse input bytes into a DER object (enforcing constraints)
Source§

impl<T, E, TagKind, const CLASS: u8, const TAG: u32> PartialEq for TaggedValue<T, E, TagKind, CLASS, TAG>
where T: PartialEq, E: PartialEq, TagKind: PartialEq,

Source§

fn eq(&self, other: &TaggedValue<T, E, TagKind, CLASS, TAG>) -> 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<T, E, TagKind, const CLASS: u8, const TAG: u32> Tagged for TaggedValue<T, E, TagKind, CLASS, TAG>

Source§

impl<T, E, const CLASS: u8, const TAG: u32> ToDer for TaggedValue<T, E, Explicit, CLASS, TAG>
where T: ToDer,

Source§

fn to_der_len(&self) -> Result<usize, Error>

Get the length of the object (including the header), when encoded
Source§

fn write_der_header( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>

Attempt to write the DER header to this writer.
Source§

fn write_der_content( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>

Attempt to write the DER content (all except header) to this writer.
Source§

fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>

Write the DER encoded representation to a newly allocated Vec<u8>.
Source§

fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>

Similar to using to_vec, but uses provided values without changes. This can generate an invalid encoding for a DER object.
Source§

fn write_der(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>

Attempt to write the DER encoded representation (header and content) into this writer. Read more
Source§

fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>

Similar to using to_der, but uses provided values without changes. This can generate an invalid encoding for a DER object.
Source§

impl<'a, 'b, T, E, const CLASS: u8, const TAG: u32> TryFrom<&'b Any<'a>> for TaggedValue<T, E, Explicit, CLASS, TAG>
where T: FromBer<'a, E>, E: From<Error>,

Source§

type Error = E

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

fn try_from( any: &'b Any<'a>, ) -> Result<TaggedValue<T, E, Explicit, CLASS, TAG>, E>

Performs the conversion.
Source§

impl<'a, T, E, const CLASS: u8, const TAG: u32> TryFrom<Any<'a>> for TaggedValue<T, E, Explicit, CLASS, TAG>
where T: FromBer<'a, E>, E: From<Error>,

Source§

type Error = E

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

fn try_from(any: Any<'a>) -> Result<TaggedValue<T, E, Explicit, CLASS, TAG>, E>

Performs the conversion.
Source§

impl<T, E, TagKind, const CLASS: u8, const TAG: u32> Eq for TaggedValue<T, E, TagKind, CLASS, TAG>
where T: Eq, E: Eq, TagKind: Eq,

Source§

impl<T, E, TagKind, const CLASS: u8, const TAG: u32> StructuralPartialEq for TaggedValue<T, E, TagKind, CLASS, TAG>