[][src]Struct asn1_der::der::DerObject

pub struct DerObject {
    pub tag: u8,
    pub payload: Vec<u8>,
}

A generic ASN.1-DER-object; can store any tag and payload

Fields

tag: u8payload: Vec<u8>

Methods

impl DerObject[src]

pub fn new(tag: u8, payload: Vec<u8>) -> Self[src]

Creates a new ASN.1-DER-object

pub fn encoded_length(&self) -> usize[src]

Computes the DER-encoded-length of this object without encoding it

Trait Implementations

impl FromDerObject for DerObject[src]

impl IntoDerObject for DerObject[src]

impl FromDerEncoded for DerObject[src]

fn from_der_encoded(data: Vec<u8>) -> Result<Self>[src]

Create a Generic-object from DER-encoded data

Parameters:

  • data: The DER-encoded data to parse

Returns either the successfully parsed object or on error:

  • Asn1DerError::NotEnoughBytes if the overall length is zero, the length-field is too short or the payload is shorter than the annotated length
  • Asn1DerError::InvalidEncoding if the length-field is invalid
  • Asn1DerError::Unsupported if the length is greater than std::usize::MAX

fn with_der_encoded(data: &[u8]) -> Result<Self>[src]

Create a Generic-object by decoding the DER-encoded data

Warning: The resulting object will contain a copy of the payload. However, the copying happens only if the object is valid and will be parsed and the copy includes only the payload (and not any other remaining data).

Parameters:

  • data: The DER-encoded data to parse; the data may be longer than the object

Returns either the successfully parsed object or on error:

  • Asn1DerError::NotEnoughBytes if the overall length is zero, the length-field is too short or the payload is shorter than the annotated length
  • Asn1DerError::InvalidEncoding if the length-field is invalid
  • Asn1DerError::Unsupported if the length is greater than std::usize::MAX

impl IntoDerEncoded for DerObject[src]

fn into_der_encoded(self) -> Vec<u8>[src]

DER-encodes this object

impl Eq for DerObject[src]

impl PartialEq<DerObject> for DerObject[src]

impl Clone for DerObject[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for DerObject[src]

impl Debug for DerObject[src]

Auto Trait Implementations

impl Send for DerObject

impl Sync for DerObject

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]