xref: /PHP-7.1/ext/openssl/tests/bug66501.phpt (revision 7af945e2)
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?>
8--FILE--
9<?php
10$pkey = 'ASN1 OID: prime256v1
11-----BEGIN EC PARAMETERS-----
12BggqhkjOPQMBBw==
13-----END EC PARAMETERS-----
14-----BEGIN EC PRIVATE KEY-----
15MHcCAQEEILPkqoeyM7XgwYkuSj3077lrsrfWJK5LqMolv+m2oOjZoAoGCCqGSM49
16AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNWVugYFtPg/xLQw0mHkIPZ4DvK
17sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
18-----END EC PRIVATE KEY-----';
19$key = openssl_pkey_get_private($pkey);
20$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
21var_dump($res);
22?>
23--EXPECTF--
24bool(true)
25