Closed benmaddison closed 3 years ago
If your raise in _get_tab_obj()
, bad things will happen in the decoding of OPEN types (https://github.com/P1sec/pycrate/blob/aef4e0ee9f5f70afd2bdacac3147983cbf05c05d/pycrate_asn1rt/asnobj_ext.py#L76).
This is because an OPEN object can get its value by other ways than just doing a look up in a constraint table, during the decoding process.
As such, I am not going to pull your PR. I need to further investigate this and will try to develop another solution.
Resolves #139
This adds logic to the decoding of
BIT STRING
andOCTET STRING
values with aCONTAINING
constraint.An exception is raised if a matching object information instance was found on the lookup-table of the
OPEN
object, but the instance did not include the referenced field.The exception causes processing of the
CONTAINING
constraint to abort, and fall back to decoding the value as a bareBIT/OCTET STRING
.The case where the referenced field is
OPTIONAL
on theCLASS
definition is distinguishable by the type of exception raised. A warning is only printed where the field is non-OPTIONAL
.Updated exception handling has been implemented for BER/DER, and those that clearly follow the same logic.
Similar logic may be needed in the JER/OER/etc. cases. I am not familiar enough with those code-paths to provide this without some guidance.