[英]Decrypt string that is encrypted by MCRYPT_RIJNDAEL_128
I used following codes to encrypt and decrypt the strings in php.我使用以下代码对 php 中的字符串进行加密和解密。 I recently upgraded my server and now i can see that the codes i use is depreciated.
我最近升级了我的服务器,现在我可以看到我使用的代码已经贬值了。 Encryption code is hardcoded on my app so i need to decrypt on the server.
加密代码在我的应用程序上是硬编码的,所以我需要在服务器上解密。 Please provide the alternative to both encrypt and decrypt
请提供加密和解密的替代方案
Code for encryption.用于加密的代码。
function encrypt($data = '', $key = 'chiperbase65enus')
{
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, 'chiperbase65enus');
return base64_encode($encrypted);
}
And for decryption is below.解密如下。 I dont actually need encryption anymore but decryption is the must.
我实际上不再需要加密,但必须解密。
function decrypt($data = '', $key = 'chiperbase65enus')
{
$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, base64_decode($data), MCRYPT_MODE_CBC,'chiperbase65enus');
return rtrim($decrypted, "\0");
}
$decrypted = openssl_decrypt(base64_decode($encrypted_string), "AES-128-CBC", "chiperbase65enus",OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, "chiperbase65enus");
I found the solution...我找到了解决方案...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.