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