rusticata / der-parser

BER/DER parser written in pure Rust. Fast, zero-copy, safe.
Apache License 2.0
85 stars 28 forks source link

It would be good if .as_u64() could parse BitStrings into numbers, too #28

Closed p1-mmr closed 4 years ago

p1-mmr commented 4 years ago

Hello,

I think that it would be useful if .as_u64() could parse BIT STRING values into numbers, too, as BitStrings turns out to be sometimes used as enumerated integer values in ASN.1 definitions.

I will maybe make a pull request for that if the maintainer is OK.

chifflier commented 4 years ago

That looks great for the cases the bitstring is indeed the representation of a small integer. I applied #29, thanks (so closing issue)

For other cases, I'm wondering if the bitvec crate would be a good crate to use to abstract values.