Struct derp::Der
[−]
[src]
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]
fn new(writer: &'a mut W) -> Self
Create a new Der
structure that writes values to the given writer.
fn write_null(&mut self) -> Result<()>
Write a NULL
tag.
fn write_element(&mut self, tag: Tag, input: &[u8]) -> Result<()>
Write an arbitrary element.
fn write_integer(&mut self, input: &[u8]) -> Result<()>
Write the given input as an integer.
fn write_positive_integer(&mut self, input: &[u8]) -> Result<()>
Write the given input as a positive integer.
fn write_sequence<F: FnOnce(&mut Der<Vec<u8>>) -> Result<()>>(
&mut self,
func: F
) -> Result<()>
&mut self,
func: F
) -> Result<()>
Write a SEQUENCE
by passing in a handling function that writes to an intermediate Vec
before writing the whole sequence to self
.
fn write_oid(&mut self, input: &[u8]) -> Result<()>
Write an OBJECT IDENTIFIER
.
fn write_raw(&mut self, input: &[u8]) -> Result<()>
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.
fn write_bit_string<F: FnOnce(&mut Der<Vec<u8>>) -> Result<()>>(
&mut self,
unused_bits: u8,
func: F
) -> Result<()>
&mut self,
unused_bits: u8,
func: F
) -> Result<()>
Write a BIT STRING
by passing in a handling function that writes to an intermediate Vec
before writing the whole sequence to self
.
fn write_octet_string<F: FnOnce(&mut Der<Vec<u8>>) -> Result<()>>(
&mut self,
func: F
) -> Result<()>
&mut self,
func: F
) -> Result<()>
Write a OCTET STRING
by passing in a handling function that writes to an intermediate Vec
before writing the whole sequence to self
.