PHP Encrypt and Windows Decrypt

后端 未结 3 1576
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 13:49

I \'m stuck. It seems that AES encryption done by PHP cannot be decrypted in windows.

PHP code:

$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL         


        
3条回答
  •  别那么骄傲
    2021-02-07 14:35

    PHP MCRYPT functions are a bit different than the windows decryption functions.

    Because the mcrypt function takes the key of any length and converts it to the length required by the algorithm by adding \0 at the end of key string.

    Please note to create a key with the specified length required for the encryption by the algorithm on both sides.

    use md5 on the key and then convert it to the length required for the algorithm.

提交回复
热议问题