-
- Downloads
Add `SET|SEQUENCE OF ANY` encoding support
For example: AttributeTypeAndValues ::= SEQUENCE { type OBJECT IDENTIFIER, values SET OF ANY DEFINED BY type } This patch adds support of the above ASN.1 syntax to BER/DER/CER codecs. It appears that to implement this feature properly, `SetOf`/`SequenceOf` pyasn1 types need to have `.componentType` wrapped into something similar to `NamedType` that `Set`/`Sequence` have. That additional layer would then carry the open type meta information. Without it, `Sequence`/`Set` codec needs to signal `SetOf`/`SequenceOf` codec of the open type being processed, which is a slight hack. A other inconvenience is that when `SetOf`/`SequenceOf` deal with an open type component, they should not verify types on component assignment. Without open type property in `SetOf`/`SequenceOf`, the code checks for `Any` component type which is another hack. The above shortcomings should be addressed in the follow up patch.
Showing
- CHANGES.rst 1 addition, 0 deletionsCHANGES.rst
- pyasn1/codec/ber/decoder.py 44 additions, 12 deletionspyasn1/codec/ber/decoder.py
- pyasn1/codec/ber/encoder.py 68 additions, 20 deletionspyasn1/codec/ber/encoder.py
- pyasn1/type/univ.py 12 additions, 6 deletionspyasn1/type/univ.py
- tests/codec/ber/test_decoder.py 161 additions, 8 deletionstests/codec/ber/test_decoder.py
- tests/codec/ber/test_encoder.py 124 additions, 0 deletionstests/codec/ber/test_encoder.py
Loading
Please register or sign in to comment