Im trying to decode a field called Subject Key Identifier (RFC 5820), which was contained within a CMS certificate (RFC 6488). I have for most of the previous "work" successfully used pyasn1 and pyasn1_modules to decode ASN1 structures. However i get the error:
pyasn1.error.SubstrateUnderrunError: 31<18 at <TagSet object, tags 128:32:15>
Using the debugger i found that the problem occurred when reading:
AF 9F 00 96 C2 39 12 D7 8F 6A D6 D6 35 9B A4 88 FB 3A 32 A0
Looking at the first Octet (AF -> 10101111) my understanding is that this is Constructed Definite length-method with the identifier is 15.
Since the first octet is done, the second is the length. 9F -> 10011111, since MSB is set, the length will set by the 31 next octets. However the whole "payload" is 20 bytes (octets). How does this make sense?
(I suppose that the values, 31 and 18 is what the error tells me, but ill keep the explanation if any other beginner finds it useful!)