CryptDecodeObjectEx Bad Tag ERROR (0x8009310b)
I have a .cer file. I can read it and write a buffer through the ReadFile () function. Now I have the buffer and datalen that I had.
And I use this buffer and len to call CryptDecodeObjectEx () function like below line
if ( !CryptDecodeObjectEx( X509_ASN_ENCODING,
X509_PUBLIC_KEY_INFO,
(BYTE* )pemPubKey,
readLen,
CRYPT_DECODE_ALLOC_FLAG,
NULL,
&publicKeyInfo,
(DWORD *)&publicKeyInfoLen ) )
But when I run it via debug I get error code 0x8009310B using GetLastError () function.
How can I fix this? Thank you for your advice.
Additional Information
- If I use X509_ANY_STRING instead of X509_PUBLIC_KEY_INFO; it works. But it doesn't populate my publicKeyInfo structure. Because of this, I cannot get the public key in it.
- I have a DER formatted certificate.
+3
source to share
No one has answered this question yet
Check out similar questions: