I have a DER Sequence which I was able to parse using asn1 module from pycrypto. Now that pycrypto was deprecated, I want to move to pyasn1.
Below is my code snippet:
x = "308201cc04080c000000000000000408a80de7c97e000000161036633533346433323334333337653533308201a0301e040804000000000000000408240000000000000004089f86010000000000301e040804000000000000000408400d0300000000000408df93040000000000301e040805000000000000000408180000000000000004089f86010000000000301e040805000000000000000408e09304000000000004087f1a060000000000301e040806000000000000000408000000000000000004089f86010000000000301e040807000000000000000408240000000000000004089f86010000000000301e040808000000000000000408000000000000000004089f86010000000000301e040809000000000000000408000000000000000004089f86010000000000301e04080a000000000000000408000000000000000004089f86010000000000301e04080b000000000000000408000000000000000004089f86010000000000301e04080c000000000000000408000000000000000004089f86010000000000301e04080d000000000000000408000000000000000004089f86010000000000301e04080e000000000000000408000000000000000004089f860100000000003000"
from pyasn1.codec.der import decoder
decoder.decode(bytes.fromhex(x))
The decode resulted in the error:
"attributeError("'NoneType' object has no attribute 'tagSet'")"
I know the error is due to the last sequence (representing NULL without value): 3000.
This was working previously with asn1 from pycrypto (which was deprecated). I wanted to switch my code to pyasn1. Any help?
OpenSSL works fine:
echo "<hex string>" | xxd -p -r | openssl asn1parse -inform dev
So, the error is only with pyasn1. Is there any workaround for this? Or any options that we can pass while decoding?
<Sequence schema object ...>(not "value") with no trace of the contents, which is clearly wrong. Also you do realize that even though pycrypto is dead, pycryptodome is healthy and claims API compatibility?