| Previous | Next |
| CRYPT_E_ASN1_EOD | CRYPT_E_ASN1_LARGE |
CRYPT_E_ASN1_CORRUPT
The bytes violate the ASN.1 encoding structure
CRYPT_E_ASN1_CORRUPT is a structural decode failure. The decoder found an identifier, length, nesting relationship, or primitive encoding that cannot form a valid instance of the requested ASN.1 object. It is broader than a single wrong tag and often indicates that the buffer is not the object type the caller believes it is.
Common examples include a length that extends outside its parent, invalid constructed encoding, damaged DER copied from a transport, or attempting to decode an entire PEM file as binary DER. Certificate-chain trust settings cannot repair malformed bytes.
Evidence to collect
- Preserve the original buffer before any text or base64 conversion.
- Confirm whether the data is DER, PEM, PKCS #7, PKCS #10, or another container.
- Decode the outermost tag and length independently to locate the first inconsistent offset.
- Compare the caller's
lpszStructTypewith the actual top-level ASN.1 type.
References
- ITU-T X.690: BER, CER, and DER structure
- Microsoft: supported CryptDecodeObject object types
- Microsoft: certificate context encoding and decoding
Looking for a different code? Search another status or error code.