Struct DerObject

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

An untyped DER object

Implementations§

Source§

impl<'a> DerObject<'a>

Source

pub fn new<S: Sink + Into<&'a [u8]>>( tag: u8, value: &[u8], sink: S, ) -> Result<Self, Asn1DerError>

Writes a new DER object with tag and value into sink and returns a view over it

Source

pub fn new_from_source<A: Source, B: Sink + Into<&'a [u8]>>( tag: u8, len: usize, value: &mut A, sink: B, ) -> Result<Self, Asn1DerError>

Writes a new DER object with tag, len and value into sink and returns a view over it

Source

pub fn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError>

Decodes an object from raw

Source

pub fn decode_from_source<A: Source, B: Sink + Into<&'a [u8]>>( source: &mut A, sink: B, ) -> Result<Self, Asn1DerError>

Reads a DER-TLV structure from source by parsing the length field and copying the necessary bytes into sink and returns a view over it

Source

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

The underlying raw slice

Source

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

The object header

Source

pub fn tag(self) -> u8

The object tag

Source

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

The object value

Source

pub fn encode<U: Sink>(&self, sink: &mut U) -> Result<(), Asn1DerError>

Encodes self to sink

Source

pub fn write<A: Source, B: Sink>( tag: u8, len: usize, value: &mut A, sink: &mut B, ) -> Result<(), Asn1DerError>

Writes a tag-len-value combination as DER-TLV structure into sink

Trait Implementations§

Source§

impl<'a> Clone for DerObject<'a>

Source§

fn clone(&self) -> DerObject<'a>

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<'a> DerDecodable<'a> for DerObject<'a>

Source§

fn load(object: DerObject<'a>) -> Result<Self, Asn1DerError>

Loads object as Self
Source§

fn decode(raw: &'a [u8]) -> Result<Self, Asn1DerError>

Decodes an object as Self
Source§

fn decode_at(raw: &'a [u8], header_start: usize) -> Result<Self, Asn1DerError>

Decodes an object as Self
Source§

fn decode_from_source<A: Source, B: Sink + Into<&'a [u8]>>( source: &mut A, sink: B, ) -> Result<Self, Asn1DerError>

Reads an object from source by parsing the length field and copying the necessary bytes into sink and decoding it from sink
Source§

impl<'a> DerEncodable for DerObject<'a>

Source§

fn encode<S: Sink>(&self, sink: &mut S) -> Result<(), Asn1DerError>

Encodes self into sink
Source§

fn der_object<'a, S: Sink + Into<&'a [u8]>>( &self, sink: S, ) -> Result<DerObject<'a>, Asn1DerError>

Creates an DER object from an encodable type
Source§

impl<'a> Copy for DerObject<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for DerObject<'a>

§

impl<'a> RefUnwindSafe for DerObject<'a>

§

impl<'a> Send for DerObject<'a>

§

impl<'a> Sync for DerObject<'a>

§

impl<'a> Unpin for DerObject<'a>

§

impl<'a> UnwindSafe for DerObject<'a>

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.