1--TEST--
2openssl_pkey_derive() ECDH
3--SKIPIF--
4<?php if (!extension_loaded("openssl") || !defined("OPENSSL_KEYTYPE_EC")) print "skip"; ?>
5--FILE--
6<?php
7
8$priv = openssl_pkey_get_private("-----BEGIN EC PRIVATE KEY-----
9MIHbAgEBBEEHI4mYyIOu8zQYAThKCgDIj4JAMekWFcrJSSa4K+C80xtrT07tz1Yj
10mZdn+7/sAuZ4HBg56EzFBhLGxwGDakot1qAHBgUrgQQAI6GBiQOBhgAEARnoOOKF
11c+1CNtrq2Jq0GvcBjIi1kJpQLfFF1RFgP/jVDeimSJi8elAtl6NqdikDVSIg6ZwT
126XOz6IdPRZsCMsWyAYeWz2jTRoT93nGLm9G96jwOm0VhLHjp3WtTY4kDp9dVHdhH
13x3Nz35sz8u0CE6befv+Fxo5ORq373v9eDzp62Z8g
14-----END EC PRIVATE KEY-----
15");
16
17$pub = openssl_pkey_get_public("-----BEGIN PUBLIC KEY-----
18MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBGs5c8VCdd3VcOAUhuCzEB6uMUDob
19lG5vtncWqvHfcnsR4uHEuufl24rbraVFyVeGr/BV0AfUnnhKGnaEtSDG9h4BMw5A
20vHiBzBCZUlA1TUMSmNpedutkZul4h6gYNrzFtfjmbqSnC0732YgUIrr4yueOSL2E
21N2IRPU2MF6S0S6i44MU=
22-----END PUBLIC KEY-----
23");
24
25echo bin2hex(openssl_pkey_derive($pub,$priv));
26echo "\n";
27?>
28--EXPECT--
2901171967cc0ddc553b46c6a821502aaea44aa04e6933d897ea11222efa0556f2d5d972816676c9ccf4e2430a26e07193ad39373050f6e54e4059f17720d7dd667635
30