I have done Encryption of a File using C++ with ENCRYPT_ALGORITHM
as CALG_RC4
. The code is working fine. When I changed the ENCRYPT_ALGORITHM
to CALG_AES_256
it fails.
if(CryptAcquireContext(
&hCryptProv,
NULL,
MS_ENHANCED_PROV,
PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT))
and
if(!CryptDeriveKey(
hCryptProv,
ENCRYPT_ALGORITHM,
hHash,
KEYLENGTH,
&hKey))
fails with the error no. 0x80090016
and 0x8009000f
I want to perform AES 256 Encryption and also want to include the SHA-512 hashing along with the encryption CALG_SHA_512
. What are the things I need to modify?
Note: I don't want to use any 3rd Party API's for performing this operation.
User contributions licensed under CC BY-SA 3.0