TheIronDuke
asked on
Using CryptoAPI in C++ in an MFC unicode application
I read Dan Rollins excellent article "Easy String Encryption Using CryptoAPI in C++":
https://www.experts-exchange.com/articles/1193/Easy-String-Encryption-Using-CryptoAPI-in-C.html
I got the class to compile and run no problem. But in my application it encrypts the string, but will not decrypt. The CryptoAPI function CryptDecrypt fails with error NTE_BAD_LEN. I tried increasing the output buffer size to a much larger value, but then it simply returns an incorrect decryption of the input string. I have even tried just passing simple char and LPCSTR values to it, and it is no-go.
I am thinking this might be an issue with unicode, but I admit that I am a bit lost. Any help would be appreciated.
https://www.experts-exchange.com/articles/1193/Easy-String-Encryption-Using-CryptoAPI-in-C.html
I got the class to compile and run no problem. But in my application it encrypts the string, but will not decrypt. The CryptoAPI function CryptDecrypt fails with error NTE_BAD_LEN. I tried increasing the output buffer size to a much larger value, but then it simply returns an incorrect decryption of the input string. I have even tried just passing simple char and LPCSTR values to it, and it is no-go.
I am thinking this might be an issue with unicode, but I admit that I am a bit lost. Any help would be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.