Post
Topic
Board Development & Technical Discussion
openssl making private/public keys for ethereum
by
sunsetblues
on 22/03/2018, 23:29:48 UTC
I hope someone can help me with this… I'm asking in the bitcoin forum b/c question relates to secp256k1 & openssl.

I understand how to make an ethereum public/private key & public address using linux commands.
From the command prompt three simple steps:

1)                openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > Key
2)                cat Key | grep pub -A 5 | tail -n +2 |tr -d '\n[:space:]:' | sed 's/^04//' > pub
3)                cat pub | keccak-256sum -x -l | tr -d ' -' | tail -c 41 >  address

Wala! All done! I’ve got a unique public/private key to use for my ethereum wallet.

But what I can’t figure out is how to input a set of numbers/letters into openssl and get the public/private keys like at the end of step 1.
Let’s say I like this ethereum private key but I need the public address to use it:

A114dad00000000000faced00000000000bad000000000decaf00c02bad02bad

I know I can go to an online wallet and enter the private key and get the public address which is:
0xB1607e934B61Fc1128AF1E8aa668e33d883aB3b9 (please nobody use this address keys are now public)
but I want to do this from linux prompt and get the answer.

My question: How do I enter that private key into openssl to get the private/public key pair returned something like this result?

Private-Key: (256 bit)
priv:
     0b:f3:29:aa:bf:d0:bb:0b:0f:e1:4b:80:54:f2:1a:
     2e:38:7d:cd:b5:9b:07:5f:3c:38:99:40:bd:5e:e4:
     a4:0f
pub:
     04:2f:06:55:11:4a:b1:90:11:00:a4:48:cb:6a:91:
     76:f3:01:50:2d:9f:8b:03:ab:cb:8b:67:e7:e7:d0:
     3f:85:de:e9:2a:76:59:12:94:4a:4a:ff:94:cd:d7:
     97:a2:6b:9c:ae:da:4e:ec:b0:1d:30:c0:55:14:90:
     b6:51:dd:75:09
 ASN1 OID: secp256k1   (please don’t use this key pair it’s now public)

Thanks in advance for any help… Openssl has really got me all messed up trying to figure this out.