9 ms·
Oh right, the asn1 crate, which supports CHOICE but only up to 3 alternatives, which means it can't even be used to implement X.509 certificate decoding. Makes
by lilyball 1y ago
Oh right, the asn1 crate, which supports CHOICE but only up to 3 alternatives, which means it can't even be used to implement X.509 certificate decoding. Makes me wonder what they're going to do when they get that far.
- woodruffw 1y agoI don't know why you think this; the asn1-rust crate is in fact used to implement not only X.509 certificate decoding[1] but also path validation[2]. Edit: Here's an example of a CHOICE implemented with rust-asn1 that has more than three variants[3]. [1]: https://cryptography.io/en/latest/x509/reference/ https://cryptography.io/en/latest/x509/reference/ [2]: https://cryptography.io/en/latest/x509/verification/ https://cryptography.io/en/latest/x509/verification/ [3]: https://github.com/pyca/cryptography/blob/be6c53dd03172dde6af2de775a9d8e65e6b60fb0/src/rust/cryptography-x509/src/name.rs#L52-L83 https://github.com/pyca/cryptography/blob/be6c53dd03172dde6a...
- Arnavion 1y agoThe asn1 crate provides three builtin Choice enums itself - asn1::{Choice1, Choice2, Choice3} - which support 1, 2 and 3 choices respectively. I assume that is what lilyball is referring to. But as you correctly point out the custom derive supports mapping enums with more variants to CHOICE just fine, so the builtin enums are not a relevant limitation.