Well, I started to modified the code to encrypt the message before they were inserting in DB and decrypt them whem they are selecting from de DB.
I change the function post_mess in server/freichat.php:
if ($_POST['message_type'] == 'normal' || $_POST['message_type'] == 1) {
$chatroom_mesg_time = $_POST['chatroom_mesg_time'];
$encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key))));
$insert_mesg_query->execute(array($frm_id, $usr_name, $to, $to_name, $encrypted_mesg, $time, $message_type, '-1'));
} else {
//$chatroom_mesg_time = $time;
$chatroom_mesg_time = $_POST['chatroom_mesg_time'];
$encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key))));
$insert_mesg_query->execute(array($frm_id, $usr_name, $room_id, $room_id, $encrypted_mesg, $time, $message_type, $room_id));
}
With the above code i could save the messages encrypted, but now I need to decrypt them but I can find the point of code to make that. If some freichat developer read this post, could you tell me where I can get the message from the DB and then decrypt it.
I am using the single chat, not chatrooms.
Regards,
JM
Well, I started to modified the code to encrypt the message before they were inserting in DB and decrypt them whem they are selecting from de DB.
I change the function post_mess in server/freichat.php:
<code>
if ($_POST['message_type'] == 'normal' || $_POST['message_type'] == 1) {
$chatroom_mesg_time = $_POST['chatroom_mesg_time'];
$encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key))));
$insert_mesg_query->execute(array($frm_id, $usr_name, $to, $to_name, $encrypted_mesg, $time, $message_type, '-1'));
} else {
//$chatroom_mesg_time = $time;
$chatroom_mesg_time = $_POST['chatroom_mesg_time'];
$encrypted_mesg = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $message, MCRYPT_MODE_CBC, md5(md5($key))));
$insert_mesg_query->execute(array($frm_id, $usr_name, $room_id, $room_id, $encrypted_mesg, $time, $message_type, $room_id));
}
</code>
With the above code i could save the messages encrypted, but now I need to decrypt them but I can find the point of code to make that. If some freichat developer read this post, could you tell me where I can get the message from the DB and then decrypt it.
I am using the single chat, not chatrooms.
Regards,
JM