forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for bug66501 - "key type not supported in this PHP build"
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |