Function yasna::construct_der_seq

source ·
pub fn construct_der_seq<F>(callback: F) -> Vec<u8>
where F: FnOnce(&mut DERWriterSeq<'_>),
Expand description

Constructs DER-encoded sequence of data as Vec<u8>.

This is similar to construct_der, but this function accepts more than one ASN.1 values.

This function uses the loan pattern: callback is called back with a DERWriterSeq, to which the ASN.1 values are written.

§Examples

use yasna;
let der = yasna::construct_der_seq(|writer| {
    writer.next().write_i64(10);
    writer.next().write_bool(true);
});
assert_eq!(der, vec![2, 1, 10, 1, 1, 255]);