2 unstable releases

Uses old Rust 2015

0.2.0 Oct 10, 2016
0.1.0 Sep 17, 2016

#9 in #ber-der

MIT/Apache

76KB
1.5K SLoC

asn1-cereal

A collection of encoders and decoders for BER, DER and ASN.1.

The grains of this library are a collection of traits and macros, that allow serialization and deserialization of rust types to and from ASN.1.

The Asn1Info, BerSerialize and BerDeserialize traits are what most users will want to use.

ASN.1 Elements

These pages will provide more details on specific ASN.1 constructs.

Example

#[macro_use] extern crate asn1_cereal; fn main() {
  struct ShortSequence {
    z: u64,
    y: u32,
  }

  ber_sequence!(
    ShortSequence,
    "SHORT_SEQUENCE",
    z;
    y;
  );

  use asn1_cereal::BerSerialize;

  let data = ShortSequence{ z: 1, y: 2 };
  let mut bytes: Vec<u8> = Vec::new();
  BerSerialize::serialize(&data, &mut bytes).unwrap();
}

Dependencies

~130KB