Ich habe in meinem Forum den Mod Private Message Encryption and Decryption eingebaut, welcher auch bestens funktioniert. Allerdings gibt es beim verschlüsseln diese PHP Warnmeldung aus:
Das betrifft hier die Zeile 7:PHP Warning: mcrypt_encrypt(): The IV parameter must be as long as the blocksize in ...\forum\privmsg.php on line 1463
Code: Alles auswählen
if ($encrypt)
{
$cipher_alg = MCRYPT_RIJNDAEL_256;
$encrypted_message = str_replace("\\\"", "\"", $privmsg_message);
$encrypted_message = str_replace("\\'", "'", $encrypted_message);
$encrypted_message = str_replace("\\\\", "\\", $encrypted_message);
$encrypted_message = bin2hex(mcrypt_encrypt($cipher_alg, $encryption_key, $encrypted_message, MCRYPT_MODE_CFB, "1"));
$encrypted_message = wordwrap($encrypted_message, 80, "<br>", 1);
$encrypted_message = "Encrypted message follows:\n\n" . $encrypted_message;
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . $encrypted_message . "')";
}und beim entschlüsseln:
Das betrifft hier die Zeile 6:PHP Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in ...\forum\privmsg.php on line 685
Code: Alles auswählen
if ( $decrypt )
{
$cipher_alg = MCRYPT_RIJNDAEL_256;
$decrypted_message = str_replace("Encrypted message follows:\n\n", "", $private_message);
$decrypted_message = str_replace("<br>", "", $decrypted_message);
$decrypted_message = trim(mcrypt_decrypt($cipher_alg, $encryption_key, pack("H*", $decrypted_message), MCRYPT_MODE_CFB, "1"));
$private_message = str_replace("\r\n", "<br>", $decrypted_message);
$decrypted_message = str_replace("\"", """, $decrypted_message);
}