[][src]Struct derp::Der

pub struct Der<'a, W: Write + 'a> { /* fields omitted */ }

Helper for writing DER that automattically encoes tags and content lengths.

Methods

impl<'a, W: Write> Der<'a, W>[src]

pub fn new(writer: &'a mut W) -> Self[src]

Create a new Der structure that writes values to the given writer.

pub fn null(&mut self) -> Result<()>[src]

Write a NULL tag.

pub fn element(&mut self, tag: Tag, input: &[u8]) -> Result<()>[src]

Write an arbitrary element.

pub fn integer(&mut self, input: &[u8]) -> Result<()>[src]

Write the given input as an integer.

pub fn positive_integer(&mut self, input: &[u8]) -> Result<()>[src]

Write the given input as a positive integer.

pub fn nested<F: FnOnce(&mut Der<Vec<u8>>) -> Result<()>>(
    &mut self,
    tag: Tag,
    func: F
) -> Result<()>
[src]

Write a nested structure by passing in a handling function that writes to an intermediate Vec before writing the whole sequence to self.

pub fn sequence<F: FnOnce(&mut Der<Vec<u8>>) -> Result<()>>(
    &mut self,
    func: F
) -> Result<()>
[src]

Write a SEQUENCE by passing in a handling function that writes to an intermediate Vec before writing the whole sequence to self.

pub fn oid(&mut self, input: &[u8]) -> Result<()>[src]

Write an OBJECT IDENTIFIER.

pub fn raw(&mut self, input: &[u8]) -> Result<()>[src]

Write raw bytes to self. This does not calculate length or apply. This should only be used when you know you are dealing with bytes that are already DER encoded.

pub fn bit_string(&mut self, unused_bits: u8, bit_string: &[u8]) -> Result<()>[src]

Write a BIT STRING.

pub fn octet_string(&mut self, octet_string: &[u8]) -> Result<()>[src]

Write an OCTET STRING.

Auto Trait Implementations

impl<'a, W> RefUnwindSafe for Der<'a, W> where
    W: RefUnwindSafe

impl<'a, W> Send for Der<'a, W> where
    W: Send

impl<'a, W> Sync for Der<'a, W> where
    W: Sync

impl<'a, W> Unpin for Der<'a, W>

impl<'a, W> !UnwindSafe for Der<'a, W>

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.