Closed zaczkows closed 3 years ago
I took a look at the code and I'm not sure if SetOf
should be set to BTreeSet
. First of all it introduces strong dependency to Ord
trait and forces values sorting. I know that DER or BER is only one of the representations, but according to warm-welcome-to-asn1-and-der:
In BER, a SET may be encoded in any order. In DER, a SET must be encoded in ascending order by tag.
A SET OF items is encoded the same way as a SET, including the tag byte of 0x31. For DER encoding, there is a similar requirement that the SET OF must be encoded in ascending order. Because all elements in the SET OF have the same type, ordering by tag is not sufficient. So the elements of a SET OF are sorted by their encoded values, with shorter values treated as if they were padded to the right with zeroes.
Thank you for your issue! Yeah I added that type aliases but never finished the implementation, because SET/SET OF
is quite unpopular, and in formats like PER they may or may not be encoded in ascending order, so I'm still figuring out what API would allow you to safely encode a set, without worrying about this encoding order.
Also if you'd be interested, I'd be willing to accept adding any IETF ASN.1 modules related RFC7030 as crates to rasn (similar to SNMP) if you're interested in sharing the implementation.
Yeah, sure. I can try to add at least CSR attributes decoding from RFC7030 (the rest is just usual DER certificate). However, both examples in RFC requires implementation of the SET(OF).
I've an idea on how to implement it SET
encoding, I'll try to implement it soon.
I've now implemented support for SET
types, and I've also added rasn-pkix
in standards
which can decode CA certificates. Check it out, and I'll release it a few days once I've added documentation and release notes.
Hello,
I'm trying to implement very ASN.1 schema from RFC7030:
I created rust code which tries to encode/decode it:
However, I got compilation error, as it looks like the
SetOf
is not fully implemented: