File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / openssl / tests / bug66501.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 20:03:52 2014 UTC (10 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29, HEAD
php 5.4.29

--TEST--
Bug #66501: EC private key support in openssl_sign
--SKIPIF--
<?php 
if (!extension_loaded("openssl")) die("skip");
if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
--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)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>