xref: /PHP-5.6/ext/openssl/tests/bug66501.phpt (revision 9f94e0b5)
1--TEST--
2Bug #66501: EC private key support in openssl_sign
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip");
6if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
7--FILE--
8<?php
9$pkey = 'ASN1 OID: prime256v1
10-----BEGIN EC PARAMETERS-----
11BggqhkjOPQMBBw==
12-----END EC PARAMETERS-----
13-----BEGIN EC PRIVATE KEY-----
14MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
15AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
16sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
17-----END EC PRIVATE KEY-----';
18$key = openssl_pkey_get_private($pkey);
19$res = openssl_sign($data ='alpha', $sign, $key, 'ecdsa-with-SHA1');
20var_dump($res);
21--EXPECTF--
22bool(true)
23