How to uncompress a single X9.62 compressed point on an ECDH P256 curve in Go?

Viewed 1584

Golang's elliptical curve library can derive a secret key given a public coordinate with a X and Y value (uncompressed coordinates).

However, when the point given is a single value in X9.62 compressed form with a given y-bit, how do I uncompress it?

OpenSSL handles this scenario with this method:

https://github.com/openssl/openssl/blob/4e9b720e90ec154c9708139e96ec0ff8e2796c82/include/openssl/ec.h#L494

There also appears to be a similar question addressing the math involved, but not a best practice for Go, specifically:

https://crypto.stackexchange.com/questions/8914/ecdsa-compressed-public-key-point-back-to-uncompressed-public-key-point

How should this be done in Go?

1 Answers
Related