Hey I really need some guidance.
ATM. i am using this encryption/decryption method for regular strings.
function encrypt($pure_string) {
$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$encrypted_string = mcrypt_encrypt(MCRYPT_BLOWFISH, "!@#$%#^&*", utf8_encode($pure_string), MCRYPT_MODE_ECB, $iv);
return $encrypted_string;
}
function decrypt($encrypted_string) {
$iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypted_string = mcrypt_decrypt(MCRYPT_BLOWFISH, "!@#$%#^&*", $encrypted_string, MCRYPT_MODE_ECB, $iv);
return $decrypted_string;
}
But after some research that might not be the most secure way? The data is being stored in a MYSQL DB.
And i do not have access to install custom php plugins to the webserver. So is there any other secure way to do this?
And how should I generate / store my encryption key?
This is not used for password and etc.