KEYS: fix out-of-bounds read during ASN.1 parsing