etingof / pyasn1

Generic ASN.1 library for Python
http://snmplabs.com/pyasn1
BSD 2-Clause "Simplified" License
242 stars 118 forks source link

None ASN1 Type issue on decoding #226

Open SanthoshPillalamarry opened 2 months ago

SanthoshPillalamarry commented 2 months ago

Below is my code snippet:

x = "308201cc04080c000000000000000408a80de7c97e000000161036633533346433323334333337653533308201a0301e040804000000000000000408240000000000000004089f86010000000000301e040804000000000000000408400d0300000000000408df93040000000000301e040805000000000000000408180000000000000004089f86010000000000301e040805000000000000000408e09304000000000004087f1a060000000000301e040806000000000000000408000000000000000004089f86010000000000301e040807000000000000000408240000000000000004089f86010000000000301e040808000000000000000408000000000000000004089f86010000000000301e040809000000000000000408000000000000000004089f86010000000000301e04080a000000000000000408000000000000000004089f86010000000000301e04080b000000000000000408000000000000000004089f86010000000000301e04080c000000000000000408000000000000000004089f86010000000000301e04080d000000000000000408000000000000000004089f86010000000000301e04080e000000000000000408000000000000000004089f860100000000003000"

from pyasn1.codec.der import decoder decoder.decode(bytes.fromhex(x))

The decode resulted in the error: "ttributeError("'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 pycryptodome. I wanted to switch my code to pyasn1. Any help ?