Function yasna::construct_der
source · [−]Expand description
Constructs DER-encoded data as Vec<u8>
.
This function uses the loan pattern: callback
is called back with
a DERWriter
, to which the ASN.1 value is written.
Examples
use yasna;
let der = yasna::construct_der(|writer| {
writer.write_sequence(|writer| {
writer.next().write_i64(10);
writer.next().write_bool(true);
})
});
assert_eq!(der, vec![48, 6, 2, 1, 10, 1, 1, 255]);