Closed daniel-leicht closed 4 years ago
I think the problem is here:
namedtype.NamedType('confirmed-RequestPDU', Confirmed_RequestPDU().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))),
Within the MMSpdu
structure, confirmed-RequestPDU
field carries a subtype of Confirmed_RequestPDU
, not vanilla Confirmed_RequestPDU
that you are trying to assign.
One solution could be to have a free-standing Confirmed_RequestPDU
subtype which you could instantiate and assign. Or you can just instantiate the field:
crp = mp["confirmed-RequestPDU"]
Just keep in mind that crp
here is a reference to an object, not a copy.
Will test it again promptly, thank you!
Thank you, it works!
Hi @etingof or any other pyasn1 users!
From a research around the net it seems that pyasn1 is by far the best package to handle any ASN1 related tasks.
I am trying to use pyasn1 to encode and decode MMS PDUs.
I managed to create all the classes from the MMS ASN definition: https://pastebin.com/JitDfL2R (named it mms_classes.py)
I started by decoding a simple MMS packet and it worked, but when I tried to create one from scratch:
I get the following exception:
I tried following the documentation but still couldn't find where I went wrong.
Daniel