Ok for a while I forget about perl script.
Here is a basic question about encryption/decryption.
I encrypt a file with AES::CBC mode using a random IV( Initialization Vector ). Now how do I get back the same IV for decrypting the encrypted file?
If I use my defined hard coded IV I'm able to decode the file with no problem (as I know what the IV is) but I want to use a random IV to encrypt a file and then want to decrypt the encrypted file.
The pseudo can is something like this
void encryptFile( const char* password, const char* inFile, const char* outFile)
{
//Get random IV named iv
//Digest the password named pass
AES::Encryption aesEncryption(pass, CryptoPP::AES::DEFAULT_KEYLENGTH);
CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, iv);
//Encrypt the file
}
void decryptFile( const char* password, const char* inFile, const char* outFile)
{
//Now to decrypt the encrypted file I need to have the same IV
// with which the file was encrypted to decrypt it.
//I dont know how to get it
//Get the IV from the encrypted file
//digest the password
//Finally decrypt the encrypted file.
}
void encryptFile( const char* password, const char* inFile, const char* outFile)
{
//Get random IV named iv
//Digest the password named pass
AES::Encryption aesEncryption(pass, CryptoPP::AES::DEFAULT_KEYLENGTH);
CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, iv);
//Encrypt the file
}
void decryptFile( const char* password, const char* inFile, const char* outFile)
{
//Now to decrypt the encrypted file I need to have the same IV
// with which the file was encrypted to decrypt it.
//I dont know how to get it
//Get the IV from the encrypted file
//digest the password
//Finally decrypt the encrypted file.
}
To copy to clipboard, switch view to plain text mode
In the above code I dont know how to get the same IV by which the file was encrypted. Any idea?
If possible please give your answers taking crypto++ library in view.
Thanks.
Bookmarks