Server doesn't known clear master key anymore

This commit is contained in:
Gregory Soutade
2013-10-12 12:00:12 +02:00
parent 916d26b785
commit a9fc6d00ee
3 changed files with 263 additions and 5 deletions

View File

@@ -29,6 +29,11 @@
$MAX_ENTRY_LEN = 512;
$USERS_PATH = "./users/";
function get_mkey_hash($mkey)
{
return bin2hex(hash("sha256", $mkey, true));
}
function open_crypto($mkey)
{
if (!isset($_SESSION['td']))
@@ -38,7 +43,7 @@ function open_crypto($mkey)
if ($td == false)
die("Unable to open mcrypt");
$ret = mcrypt_generic_init($td, hash("sha256", $mkey, true), '0000000000000000');
$ret = mcrypt_generic_init($td, hex2bin($mkey), '0000000000000000');
if ($ret < 0)
{
@@ -225,7 +230,8 @@ function list_entries($user, $mkey)
{
$total_accounts++;
$login = decrypt($mkey, $row['login'], false);
if ($mkey != "")
$login = decrypt($mkey, $row['login'], false);
if ($login[0] != '@' && $login[1] != '@')
{