I have the following Encryption Classs in php
define(ENCRYPTION_KEY,"abcdegef");
define(INITIALIZATION_VECTOR,mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB), MCRYPT_RAND));
function EncryptString($input)
{
$encrypted_string = mcrypt_encrypt(MCRYPT_DES, ENCRYPTION_KEY, $input, MCRYPT_MODE_CBC, INITIALIZATION_VECTOR);
return base64_encode($encrypted_string);
}
function DecryptString($encryptedInput)
{
$decrypted_string = mcrypt_decrypt(MCRYPT_DES, ENCRYPTION_KEY, base64_decode($encryptInput), MCRYPT_MODE_CBC, INITIALIZATION_VECTOR);
return $decrypted_string;
}
And have url on anchor tag with querystring which i am encrypting
<a href="SomePage.php?action=<?php include_once ('EncryptionLibrary.php');
echo EncryptString("IamData"); ?>
When I am trying to decrypt it on SomePage.php using following code .. I am getting decrypted value incorrect
if (isset($_GET["action"]))
{
echo trim(DecryptString($_GET["action"]));
}