Skip to content

Commit 2466986

Browse files
committed
Test calculation of EC public key from private key
1 parent 14d7c7e commit 2466986

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ext/openssl/tests/ecc.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ $d2 = openssl_pkey_get_details($key2);
3535
// Compare array
3636
var_dump($d1 === $d2);
3737

38+
// Check that the public key info is computed from the private key if it is missing.
39+
$d1_priv = $d1;
40+
unset($d1_priv["ec"]["x"]);
41+
unset($d1_priv["ec"]["y"]);
42+
43+
$key3 = openssl_pkey_new($d1_priv);
44+
var_dump($key3);
45+
$d3 = openssl_pkey_get_details($key3);
46+
var_dump($d1 === $d3);
47+
3848
$dn = array(
3949
"countryName" => "BR",
4050
"stateOrProvinceName" => "Rio Grande do Sul",
@@ -95,6 +105,9 @@ bool(true)
95105
object(OpenSSLAsymmetricKey)#%d (0) {
96106
}
97107
bool(true)
108+
object(OpenSSLAsymmetricKey)#%d (0) {
109+
}
110+
bool(true)
98111
Testing openssl_csr_new with key generation
99112
NULL
100113
object(OpenSSLAsymmetricKey)#%d (0) {

0 commit comments

Comments
 (0)