| Previous | Next |
| CRYPT_E_ASN1_OVERFLOW | CRYPT_E_ASN1_BADARGS |
CRYPT_E_ASN1_BADPDU
The operation and PDU definition do not match
CRYPT_E_ASN1_BADPDU indicates that the ASN.1 runtime recognized a protocol data unit definition but cannot perform the requested operation for it. A PDU is the top-level ASN.1 type passed to an encoder or decoder; not every registered type supports every direction, flag, or representation.
In CryptoAPI, the selected PDU is commonly determined by lpszStructType. Passing a certificate extension structure to a decoder registered for a complete certificate, or requesting an unsupported encode path for a decode-only object, can produce this error without any corruption in the source bytes.
What to verify
- Record the exact object identifier or predefined structure constant.
- Check whether the operation is encode or decode and whether that PDU supports it.
- Separate the outer container from the extension or attribute stored inside it.
- Use the structure documented for the actual blob rather than a similarly named type.
References
- Microsoft: constants for CryptEncodeObject and CryptDecodeObject
- Microsoft: CryptDecodeObjectEx structure selection
- ITU-T X.680: ASN.1 type definitions
Looking for a different code? Search another status or error code.