rusticata / asn1-rs

Parsers/Encoders for ASN.1 BER/DER data
Apache License 2.0
9 stars 14 forks source link

ber is parsed using der #14

Closed nganhkhoa closed 2 years ago

nganhkhoa commented 2 years ago

When passed in a ber with an Infinite length content, it produces a der error on Infinite length (Error(DerConstraintFailed(IndefiniteLength))). This shouldn't have happened because ber has no constrains on length.

The problem is expected to be located here. I fixed to Header::from_ber and the problem is resolved.

https://github.com/rusticata/asn1-rs/blob/5b2af8f80fe022687bbb3e831960fa38657974b8/src/ber/parser.rs#L37

I believe this is a typo and should be fixed.

P/S: The ber I tried to parse is from an Apple signature chain in any signed binary, and I assume it to be correct (checked using https://lapo.it/asn1js/). Using the rusticata/der-parser parse_ber function.