I have a .cer file. I can read it and write a buffer via ReadFile() function. Now I have buffer and datalen which I had.
And I use that buffer and len for calling 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 through debug, I get 0x8009310B error code via GetLastError() func.
How can I fix it? Thanks for your advice.
Additional Information
User contributions licensed under CC BY-SA 3.0