<p>using MDANTER's great library i managed it to work.
if anyone needs it in the future.</p>
<pre><code>use Elliptic\EC;
$ec = new EC('secp256k1');
$pub=&quot;026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3&quot;;
$key = $ec-&gt;keyFromPublic($pub, 'hex');
print_r($key);
</code></pre>

CC BY-SA 4.0
2020-03-27T00:53:26.460Z
2021-05-09T08:25:37.280Z
2021-05-09T08:25:37.280Z
brocard
<p>in PHP how do i create the full public key from a compressed one?</p>

<p>my test key is
026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3</p>

<p>and the uncompressed one is 
6a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3
36b6fbcb60b5b3d4f1551ac45e5ffc4936466e7d98f6c7c0ec736539f74691a6</p>

<p>can this be done via openssl?</p>

<p>thanks for any helpful answer!!</p>

<public-key><php>
in PHP how to calculate full uncompressed public key from a short 02/03 pubkey?
brocard
# in PHP how to calculate full uncompressed public key from a short 02/03 pubkey?

(Asked by: username_0 on 2020-03-26)

in PHP how do i create the full public key from a compressed one?

my test key is
026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3

and the uncompressed one is
6a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3
36b6fbcb60b5b3d4f1551ac45e5ffc4936466e7d98f6c7c0ec736539f74691a6

can this be done via openssl?

thanks for any helpful answer!!

**Tags:** public-key, php


---

## 1 answers

### Answer by username_0 on 2020-03-27. Score: 1 | Accepted answer

using MDANTER's great library i managed it to work.
if anyone needs it in the future.

```
use Elliptic\EC;
$ec = new EC('secp256k1');
$pub="026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3";
$key = $ec->keyFromPublic($pub, 'hex');
print_r($key);

```


---

