I'm having trouble decrypting a file I encrypted and wrote to the
server - the following code displays the $decrypted_stri ng variable
but the data is still encrypted - any help would be appreciated:
$handle = fopen("/home/public_html/testfolder/test.txt","r");
$buffer = fgets($handle, 4096);
fclose($handle) ;
// Encryption/decryption key
$key = "twenty one years ago";
// Encryption Algorithm
$cipher_alg = MCRYPT_RIJNDAEL _128;
// Create the initialization vector for added security.
$iv = mcrypt_create_i v(mcrypt_get_iv _size($cipher_a lg,
MCRYPT_MODE_ECB ), MCRYPT_RAND);
$decrypted_stri ng = mcrypt_decrypt( $cipher_alg, $key, $buffer,
MCRYPT_MODE_CBC , $iv);
print "Decrypted string: $decrypted_stri ng";
server - the following code displays the $decrypted_stri ng variable
but the data is still encrypted - any help would be appreciated:
$handle = fopen("/home/public_html/testfolder/test.txt","r");
$buffer = fgets($handle, 4096);
fclose($handle) ;
// Encryption/decryption key
$key = "twenty one years ago";
// Encryption Algorithm
$cipher_alg = MCRYPT_RIJNDAEL _128;
// Create the initialization vector for added security.
$iv = mcrypt_create_i v(mcrypt_get_iv _size($cipher_a lg,
MCRYPT_MODE_ECB ), MCRYPT_RAND);
$decrypted_stri ng = mcrypt_decrypt( $cipher_alg, $key, $buffer,
MCRYPT_MODE_CBC , $iv);
print "Decrypted string: $decrypted_stri ng";
Comment