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 null(&mut self) -> Result<()>
Write a NULL
tag.
fn element(&mut self, tag: Tag, input: &[u8]) -> Result<()>
Write an arbitrary element.
fn integer(&mut self, input: &[u8]) -> Result<()>
Write the given input as an integer.
fn positive_integer(&mut self, input: &[u8]) -> Result<()>
Write the given input as a positive integer.
fn nested<F: FnOnce(&mut Der<Vec<u8>>) -> Result<()>>(
&mut self,
tag: Tag,
func: F
) -> Result<()>
&mut self,
tag: Tag,
func: F
) -> Result<()>
Write a nested structure by passing in a handling function that writes to an intermediate
Vec
before writing the whole sequence to self
.
fn 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 oid(&mut self, input: &[u8]) -> Result<()>
Write an OBJECT IDENTIFIER
.
fn 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 bit_string(&mut self, unused_bits: u8, bit_string: &[u8]) -> Result<()>
Write a BIT STRING
.
fn octet_string(&mut self, octet_string: &[u8]) -> Result<()>
Write an OCTET STRING
.