Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I generate a hexadecimal EC keypair with openssl?

Example output:

ec private key: 1d6d6f979fe944658ef72336d0472d122d641c347d62af8b80cbd5a6d9595298
ec public key: 043ca2e15917499a0c7de20f03a17b82a0aab1450dcaa0d704c5d969090bc10a2b1e3e60ef1d17b5201b2c35b124058cb1e034305574dfccdffda9e895a813672b
share|improve this question

migrated from crypto.stackexchange.com Jan 30 at 19:37

This question came from our site for software developers, mathematicians and others interested in cryptography.

4  
This question is about the implementation of OpenSSL, rather than the theoretical background of Cryptography as is the aim of this site. –  figlesquidge Jan 24 at 15:28

1 Answer 1

openssl ecparam -name prime256v1 -genkey > /tmp/ecprivkey.pem
openssl ec -in /tmp/ecprivkey.pem -text -noout

will print out something like this:

read EC key
Private-Key: (256 bit)
priv:
    78:5e:9a:be:d0:67:b8:93:65:00:bd:ec:95:43:36:
    d7:02:ba:ad:08:29:ae:51:1f:9e:cb:75:28:f7:0d:
    b0:fe
pub: 
    04:8c:18:af:2c:82:0a:04:c5:24:ca:50:14:05:3e:
    9c:1a:1b:d0:86:d4:95:3a:04:39:14:e2:f3:04:3c:
    5d:e3:28:98:bf:43:ec:a7:32:3f:e3:be:34:a8:b5:
    40:2a:5b:f6:7f:f0:8c:27:ae:d5:98:53:28:e8:37:
    97:15:ac:48:3d
ASN1 OID: prime256v1

which contains what you want; it is just a matter of removing the ":" characters.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.