Req #76016 [NEW]: EC keys not supported

From: Date: Tue, 27 Feb 2018 10:06:50 +0000
Subject: Req #76016 [NEW]: EC keys not supported
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214122@lists.php.net to get a copy of this message
From: nexwo at outlook dot com Operating system: Windows 7 PHP version: 7.2.2 Package: OpenSSL related Bug Type: Feature/Change Request Bug description:EC keys not supported Description: ------------ --- From manual page: http://www.php.net/function.openssl-public-encrypt --- Encrypt and decrypt don't work with EC keys. Test script: --------------- <?php //openssl ecparam -name brainpoolP256r1 -genkey -noout -out ecprivkey.pem -param_enc explicit //openssl ec -in ecprivkey.pem -pubout -out ecpubkey.pem $privKeyString = "-----BEGIN EC PRIVATE KEY----- MIIBUQIBAQQgN/imi4nGz/SJU7eB+XnFqja0Kns77jnvs9aZOT9cVHmggeMwgeAC AQEwLAYHKoZIzj0BAQIhAKn7V9uh7qm8PmYKkJ2DjXJuO/Yj1SYgKCATSB0fblN3 MEQEIH1aCXX8LDBX7vZ1MEF6/+f7gFXBJtxcbOlKS0TzMLXZBCAm3Fxs6UpLRPMw tdm713y/lYQWKVz34c5rzNwY/4wHtgRBBIvSrrnLflfLLEtIL/yBt6+53ifh470j wjpEU72azjJiVH74NcPaxP2X+EYaFGEdycJ3RRMt7Y5UXB1Uxy8EaZcCIQCp+1fb oe6pvD5mCpCdg41xjDl6o7VhpveQHg6Cl0hWpwIBAaFEA0IABJVkuTOWfb0IwE81 QepvTisqiCEdT6YnGsX7NbS4bwNEOrRJ/qdMxX3uwxATvg4ZtltbUENsEbzOVY5W npwGRzw= -----END EC PRIVATE KEY-----"; $pubKeyString = "-----BEGIN PUBLIC KEY----- MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEAqftX26Huqbw+ZgqQ nYONcm479iPVJiAoIBNIHR9uU3cwRAQgfVoJdfwsMFfu9nUwQXr/5/uAVcEm3Fxs 6UpLRPMwtdkEICbcXGzpSktE8zC12bvXfL+VhBYpXPfhzmvM3Bj/jAe2BEEEi9Ku uct+V8ssS0gv/IG3r7neJ+HjvSPCOkRTvZrOMmJUfvg1w9rE/Zf4RhoUYR3JwndF Ey3tjlRcHVTHLwRplwIhAKn7V9uh7qm8PmYKkJ2DjXGMOXqjtWGm95AeDoKXSFan AgEBA0IABKDy7MQoapZryIVWzzv/ctOoAOabi+rcgpdML3q6Jw3zjHpp5/E7tfBa 4LmXZn3ioAXYBvlGnvneltTu1/muIrg= -----END PUBLIC KEY-----"; $privKey = openssl_pkey_get_private($privKeyString); // Extract the public key from $res to $pubKey $pubKey = openssl_pkey_get_public($pubKeyString); $data = 'plaintext data goes here'; // Encrypt the data to $encrypted using the public key openssl_public_decrypt($data, $encrypted, $pubKey); // Decrypt the data using the private key and store the results in $decrypted openssl_private_decrypt($encrypted, $decrypted, $privKey); echo $decrypted; ?> Expected result: ---------------- plaintext data goes here Actual result: -------------- PHP Warning: openssl_public_decrypt(): key type not supported in this PHP build! in C:\test.php on line 32 PHP Warning: openssl_private_decrypt(): key type not supported in this PHP build! in C:\test.php on line 35 -- Edit bug report at https://bugs.php.net/bug.php?id=76016&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76016&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76016&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76016&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76016&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76016&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76016&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76016&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76016&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76016&r=support Expected behavior: https://bugs.php.net/fix.php?id=76016&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76016&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76016&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76016&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76016&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76016&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76016&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76016&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76016&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76016&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76016&r=mysqlcfg

« previous php.bugs (#214122) next »