#der #parser #asn-1 #ring #tags #version #byte

yanked ring-der

An extended version of the ASN.1 DER parser of *ring*

0.16.19 Jul 8, 2021
0.16.19-1 Jul 9, 2021

#34 in #der

ISC license

15KB
276 lines

ring-der

This crate providers an extended version of the DER parser in ring::io::der.

What's extended:

  • All tag types as defined in X.680 section 8.4;
  • High tag number, for tag numbers 31 and greater;
  • Error handling with anyhow

This crate provides the primitives for parsing ASN.1 data. The user has full control on how to interpret the bytes.

Example

use ring_der::der::parse_boolean;
use ring_der::Error;

let input = untrusted::Input::from(&[0x01, 0x01, 0xff]);
let result = input.read_all(Error::IncompleteRead, |r| parse_boolean(r));
assert_eq!(result, Ok(true));

License

See LICENSE.


lib.rs:

ring-der

This library providers an extended version of the DER parser in ring::io::der.

What's added:

  • High tag number, for tag numbers 31 and greater;
  • SET and SET OF;
  • Enumerated;
  • GeneralizedTime
  • Compatibility with anyhow

Example

use ring_der::der::parse_boolean;
use ring_der::Error;

let input = untrusted::Input::from(&[0x01, 0x01, 0xff]);
let result = input.read_all(Error::IncompleteRead, |r| parse_boolean(r));
assert_eq!(result, Ok(true));

Dependencies

~0.3–0.8MB
~19K SLoC