Function yasna::construct_der
source · pub fn construct_der<F>(callback: F) -> Vec<u8>
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]);