Decrypt using openssl
I have files that were encrypted using VC++ on windows with following
provider and type:
It's password based RC2. Below is the snippet of the code.
#ifdef USE_BLOCK_CIPHER
// defines for RC2 block cipher
#define ENCRYPT_ALGORITHM CALG_RC2
#define ENCRYPT_BLOCK_SIZE 8
#else
// defines for RC4 stream cipher
#define ENCRYPT_ALGORITHM CALG_RC4
#define ENCRYPT_BLOCK_SIZE 1
#endif
1. CryptAcquireContext( &Provider, NULL, MS_DEF_PROV, PROV_RSA_FULL,
0 )
2. Get key from hashed password
if (::CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
{
// Hash in the password data.
if (::CryptHashData(hHash, (PBYTE)pPassword,
strlen(pPassword),
0))
{
// Derive a session key from the hash object.
if (!::CryptDeriveKey(hProv,
ENCRYPT_ALGORITHM, hHash, 0
, &hKey))
{
hKey = (HCRYPTKEY)NULL;
}
}
}
3. // Encrypt data using derived key from
password
if(!::CryptEncrypt(hKey, 0, bLastBlock, 0,
pbBuffer, &dw
Count, dwBufferLen))
I am looking for relevant openssl command to decrypt the files