Issues with OpenSSL on PHP - different behaviour for different versions

后端 未结 2 1788
囚心锁ツ
囚心锁ツ 2020-12-21 16:37

(This question was originally posted on ServerFault - I have deleted it there and moved it here.)

I have a development machine running PHP 5.3.5 and a produ

相关标签:
2条回答
  • 2020-12-21 16:44

    You passed the wrong parameter of openssl_public_encrypt

    openssl_public_encrypt($data, $encrypted_data, $key1, OPENSSL_PKCS1_PADDING)

    where $key1 is the resource id use $key instead of $key1. You can use

    openssl_public_encrypt($data, $encrypted_data, $key, OPENSSL_PKCS1_PADDING)

    0 讨论(0)
  • 2020-12-21 17:03

    According to this post, the issue is related to different OpenSSL versions of Apache and PHP in the XAMPP/Windows installation. I had a similar issue with openssl_verify. I solved it by using the same OpenSSL version for both Apache and PHP (replacing DLLs). Here's a link to the solution.

    "I found a solution for the problem, it seems there are 2 wrong files in /apache/bin/ in the default 1.7.7 installation that need to be replaced by the files existing in /php/ (libeay32.ddl and ssleay32.dll)"

    0 讨论(0)
提交回复
热议问题