How can I decrypt content encrypted by MCRYPT_RIJNDAEL_128 ECB. Since mcrypt is deprecated and we have still encrypted date in our system we need to decrypt it in php7.4.9.
My "test-code" looks like:
<?php
$content = 'myCleanContent';
$key = 'myKey';
$encryptedContent = @mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $content, MCRYPT_MODE_ECB);
try{
$result = openssl_decrypt($encryptedContent,'aes-128-ecb',$key);
} catch(Exception $e){
console.error($e->getMessage());
}
if($result == $content){
echo "works 4 me";
} else {
echo "nope";
echo $result;
}
I also tried the option OPENSSL_RAW_DATA or aes-256-ecb but I'm not able to decrypt this data. What I'm doing wrong?
I also had a look at MCrypt rijndael-128 to OpenSSL aes-128-ecb conversion but I don't get it.