mirror of
https://github.com/php/php-src.git
synced 2024-12-15 21:05:51 +08:00
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fix for bug66501 - "key type not supported in this PHP build"
This commit is contained in:
commit
b60cb2b88a
@ -3467,6 +3467,15 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey TSRMLS_DC)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef EVP_PKEY_EC
|
||||
case EVP_PKEY_EC:
|
||||
assert(pkey->pkey.ec != NULL);
|
||||
|
||||
if ( NULL == EC_KEY_get0_private_key(pkey->pkey.ec)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key type not supported in this PHP build!");
|
||||
|
21
ext/openssl/tests/bug66501.phpt
Normal file
21
ext/openssl/tests/bug66501.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #66501: EC private key support in openssl_sign
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("openssl")) die("skip");
|
||||
--FILE--
|
||||
<?php
|
||||
$pkey = 'ASN1 OID: prime256v1
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BggqhkjOPQMBBw==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
|
||||
AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
|
||||
sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
|
||||
-----END EC PRIVATE KEY-----';
|
||||
$key = openssl_pkey_get_private($pkey);
|
||||
$res = openssl_sign($data ='alpha', $sign, $key, 'ecdsa-with-SHA1');
|
||||
var_dump($res);
|
||||
--EXPECTF--
|
||||
bool(true)
|
Loading…
Reference in New Issue
Block a user