You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a DTD for a standard I don’t control. It uses the RELATIVE-OID type, which is not supported by asn1tools, probably because the underlying pyasn not supporting it yet.
For my application I need to be able to decode and encode messages with RELATIVE-OID fields. However, I could live with handling them as bytes values and splitting them on my own or whatever. Which is why I’ve tried simply hacking RELATIVE-OID ::= [UNIVERSAL 13] OCTET STRING into the DTD. This will parse successfully, but when I try to decode a message, I get:
[stack abridged to only include the asn1tools part]
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/compiler.py", line 163, in decode
decoded = type_.decode(data)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1482, in decode
return self._type.decode(bytearray(data), 0)[0]
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1423, in decode
values, end_offset = self.inner.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1120, in decode
decoded, offset = member.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 717, in decode
decoded_element, offset = self.element_type.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1423, in decode
values, end_offset = self.inner.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1120, in decode
decoded, offset = member.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 594, in decode
end_offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 659, in decode_member
raise e
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 647, in decode_member
value, offset = member.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1423, in decode
values, end_offset = self.inner.decode(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 1412, in decode
offset = self.decode_tag(data, offset)
File "/home/scy/.local/lib/python3.6/site-packages/asn1tools/codecs/ber.py", line 397, in decode_tag
offset)
asn1tools.codecs.DecodeTagError: path: Expected RELATIVE-OID with tag '2d' at offset 10, but got '0d'.
So, the message that I’m receiving encodes RELATIVE-OID with a tag of 0d (i.e. universal primitive 13), but asn1tools expects 2d (universal constructed 13), right?
My knowledge of ASN.1 is pretty limited and I openly admit that I don’t really know what I’m doing. Can you help me out?
My project is commercial but rather time-critical right now. (Read: I need to fix this somehow within the next 24 hours.) I’m open to discussing compensation for your time if you’d like and I’ve already tried to contact you via Twitter about it. Of course I know that this is an open source project and I can’t expect anything, I’m merely asking.
The text was updated successfully, but these errors were encountered:
Adding RELATIVE-OID ::= [UNIVERSAL 13] IMPLICIT OCTET STRING to the DTD solved it for me. Designating it as IMPLICIT was the key, since the tag is now 0d instead of 2d.
I now get the RELATIVE-OID as a simple bytes object, which works well enough for my purposes.
Hi there! First of all, thanks for this library.
I have a DTD for a standard I don’t control. It uses the
RELATIVE-OID
type, which is not supported byasn1tools
, probably because the underlyingpyasn
not supporting it yet.For my application I need to be able to decode and encode messages with
RELATIVE-OID
fields. However, I could live with handling them asbytes
values and splitting them on my own or whatever. Which is why I’ve tried simply hackingRELATIVE-OID ::= [UNIVERSAL 13] OCTET STRING
into the DTD. This will parse successfully, but when I try to decode a message, I get:So, the message that I’m receiving encodes
RELATIVE-OID
with a tag of0d
(i.e. universal primitive 13), butasn1tools
expects2d
(universal constructed 13), right?My knowledge of ASN.1 is pretty limited and I openly admit that I don’t really know what I’m doing. Can you help me out?
My project is commercial but rather time-critical right now. (Read: I need to fix this somehow within the next 24 hours.) I’m open to discussing compensation for your time if you’d like and I’ve already tried to contact you via Twitter about it. Of course I know that this is an open source project and I can’t expect anything, I’m merely asking.
The text was updated successfully, but these errors were encountered: