I am trying to output the public EC key parameters Qx and Qy from OpenSSL CLI. Is this possible?
Asked
Active
Viewed 641 times
1 Answers
5
You can create an elliptic curve key with
openssl ecparam -out key.pem -name prime256v1 -genkey
Output the public and private key with
openssl ec -inform PEM -in key.pem -pubout -text -noout

Chiara Hsieh
- 3,273
- 23
- 32
-
I've gotten that far. But the public key is in bit string format. I would like to convert the public key bit string into the public elements Qx and Qy through CLI. – feederic Apr 11 '13 at 01:59
-
What do you mean convert them into public element? You want to store them in separate files? Or output them on CLI separately? – Chiara Hsieh Apr 11 '13 at 02:05
-
Say I have a public key in PEM format below: MHcCAQEEIEgB3YOgsNr/kqwoaiofi21fvFg0wSbxYhNL9nQz56broAoGCCqGSM49 AwEHoUQDQgAE84C3kx+BqjqdD3ENazbpqbQcFiPYoghiJ1QV43nlAuJtXAVs4m1H pHnUYEzSiV1oT6MphKlZvadrchXEeHygWA== This should represent a point on the elliptic curve, and contains a two byte header and two 33 byte values consisting of Qx and Qy (the point on the EC Curve). What steps, if any, are needed to obtain Qx and Qy from the public key while utilizing the CLI? – feederic Apr 11 '13 at 02:37
-
Unfortunately there's no such command. To decode the public key, the simplest way is using function utilities that OpenSSL provides. – Chiara Hsieh Apr 11 '13 at 04:23
-
Thanks! I could not find it myself, but now I know. Time to write an application to handle this for me. – feederic Apr 11 '13 at 18:23