title: Decoding ASN1 encoded "Subject Key Identifier" with weird length
body: <p>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:</p>
  
  <pre><code>pyasn1.error.SubstrateUnderrunError: 31&lt;18 at &lt;TagSet object, tags 128:32:15&gt;
  </code></pre>
  
  <p>Using the debugger i found that the problem occurred when reading:</p>
  
  <pre><code>AF 9F 00 96 C2 39 12 D7 8F 6A D6 D6 35 9B A4 88 FB 3A 32 A0
  </code></pre>
  
  <p>Looking at the first Octet (AF -> 10101111) my understanding is that this is Constructed Definite length-method with the identifier is 15. </p>
  
  <p>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? </p>
  
  <p>(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!)</p>