0

I can easily generate a new pair

$ openssl ecparam -genkey -name secp256k1 -param_enc explicit | openssl pkey -noout -text
Private-Key: (256 bit)
priv:
    61:98:b4:78:a4:59:47:86:ef:2d:aa:4f:2a:21:91:
    60:11:18:ff:8f:79:83:c6:f7:d6:1c:b8:9f:1a:85:
    1e:47
pub:
    04:4f:c4:07:1e:f1:dd:56:39:61:31:2b:75:53:68:
    e5:c4:99:53:67:af:da:6b:09:75:2b:a4:d3:3a:40:
    32:50:b3:fa:23:05:cc:83:bb:b0:f7:76:30:37:64:
    df:47:5f:fa:49:b3:39:9e:3c:8b:34:59:5b:23:fb:
    91:7a:1b:73:6b
Field Type: prime-field
Prime:
    00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
    ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe:ff:
    ff:fc:2f
A:    0
B:    7 (0x7)
Generator (uncompressed):
    04:79:be:66:7e:f9:dc:bb:ac:55:a0:62:95:ce:87:
    0b:07:02:9b:fc:db:2d:ce:28:d9:59:f2:81:5b:16:
    f8:17:98:48:3a:da:77:26:a3:c4:65:5d:a4:fb:fc:
    0e:11:08:a8:fd:17:b4:48:a6:85:54:19:9c:47:d0:
    8f:fb:10:d4:b8
Order: 
    00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:
    ff:fe:ba:ae:dc:e6:af:48:a0:3b:bf:d2:5e:8c:d0:
    36:41:41
Cofactor:  1 (0x1)

but how do I for a given private ECDSA key

18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725

find its paired public key?

0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352

As opposed to coding, can this be achieved by means of OpenSSL CLI and perhaps other standard Linux utilities?


I tried following man ec which only got me this far:

$ openssl ec -modulus      
ec: Unrecognized flag modulus
ec: Use -help for summary.

Then I thought of adding a custom priv to the specified parameters for -genkey to generate the key from. But to even try this one, I'm not sure how to avoid messing directly with DER file format.


$ openssl version
OpenSSL 1.1.1  11 Sep 2018
darw
  • 941
  • 12
  • 15
  • 1
    Yes you effectively need to fake the key format, either DER or PEM but the first is a little easier; see https://stackoverflow.com/questions/48101258/how-to-convert-an-ecdsa-key-to-pem-format (mine) https://stackoverflow.com/questions/51845590/digitally-sign-a-hex-string-in-command-line-using-elliptic-curve-secp256k1 or cross https://bitcoin.stackexchange.com/questions/66594/signing-transaction-with-ssl-private-key-to-pem PS: if you want this key to interoperate with anything else besides local OpenSSL, param_enc explicit will cause most things to fail. – dave_thompson_085 Jun 13 '20 at 00:47
  • That looks like it could be turned into a nice answer to the question. – David C. Rankin Jun 13 '20 at 00:53

0 Answers0