Samuel-Tyler / fast_ber

A C++11 ASN.1 BER Encoding and Decoding Library
Boost Software License 1.0
84 stars 11 forks source link

Correctly parse SET in BER mode #8

Closed Samuel-Tyler closed 3 years ago

Samuel-Tyler commented 4 years ago

Components of a SET may be arranged in any order. Currently parsing requires that they should be decoded in order. Correct this.

Elements in the SET may appear in any order. Duplicate items should be detected, causing a compilation failure. Lack of mandatory items should also be detected.

8.11Encoding of a set value8.11.1The encoding of a set value shall be constructed.8.11.2The contents octets shall consist of the complete encoding of a data value from each of the types listed in the ASN.1 definition of the set type, in an order chosen by the sender, unless the type was referenced with the keyword OPTIONALor the keyword DEFAULT.
The encoding of a data value may, but need not, be present for a type which was referenced with the keyword OPTIONALor the keyword DEFAULT.NOTE –The order of data values in a set value is not significant, and places no constraints on the orderduring transfer.
benys commented 4 years ago

Do you predict implement SETs?

Samuel-Tyler commented 4 years ago

Yes, it shouldn't be a big job I'll try to complete it this weekend

benys commented 4 years ago

Nice to hear you!

BTW your yacc grammar not work in bison (GNU Bison) 3.6.4. Should I create new Issue?

Samuel-Tyler commented 4 years ago

Yes, please, I have noticed this too. You can compile in release mode / set a CMake flag to avoid the generation in the meantime.

Samuel-Tyler commented 4 years ago

Created PR to cover this: https://github.com/Samuel-Tyler/fast_ber/pull/33