Originally posted by drawmack
I could be mistaken, but I thought that was a security feature for authentication purposes.
I believe that PGP uses the asymmetric encryption on the key only
because using that cipher on long pieces of text could be very
costly (in CPU terms)
BTW:
Here's what I have, and it crashes :
function enc_rijn($input,$key,$mode = 'cfb') {
$td = mcrypt_module_open('rijndael-128','',$mode,'');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td,$key,$iv);
$ciphertext = mcrypt_generic($td,$input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $ciphertext;
}
function dec_rijn($input,$key,$mode = 'cfb') {
$td = mcrypt_module_open('rijndael-128','',$mode,'');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td,$key,$iv);
$plaintext = mdecrypt_generic($td,$input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $plaintext;
}
$test = 'This is the message to be encrypted';
$key = 'this is the key';
$ciphertext = enc_rijn($test,$key);
echo dec_rijn($ciphertext,$key);
Any ideas?