Edit: to restate this, I have a PEM private key that should point to a bitcoin address, but maybe it doesn't. I want to find out how to validate a yes or no on this.
Run the below command on (to be safe: a copy of) your file (I'm on a Debian-derived Linux distro, with the
openssl package pre-installed):
$ openssl ec -in key.pem -noout -text
Based on your description of what you have, I'm guessing you'll either see output like this:
read EC key
Private-Key: (256 bit)
priv:
1f:42:88:fb:f0:73:e4:25:c0:76:14:ff:9b:8a:2a:
a8:c2:3c:a4:10:49:4d:83:31:36:f8:1c:25:be:f0:
44:86
pub:
04:f2:72:85:d6:91:9a:db:da:5d:7a:b5:33:1a:bb:
86:a3:e9:b5:52:4f:d3:b0:30:e8:82:1e:c9:0d:a9:
f3:57:04:1e:1f:0f:fd:5f:7e:2b:11:af:09:1a:24:
5e:cf:18:80:05:4f:8e:37:64:1b:e2:e2:77:ee:74:
ea:93:29:77:88
ASN1 OID: secp256k1
Or something a little more detailed, like this:
read EC key
Private-Key: (256 bit)
priv:
1f:42:88:fb:f0:73:e4:25:c0:76:14:ff:9b:8a:2a:
a8:c2:3c:a4:10:49:4d:83:31:36:f8:1c:25:be:f0:
44:86
pub:
04:f2:72:85:d6:91:9a:db:da:5d:7a:b5:33:1a:bb:
86:a3:e9:b5:52:4f:d3:b0:30:e8:82:1e:c9:0d:a9:
f3:57:04:1e:1f:0f:fd:5f:7e:2b:11:af:09:1a:24:
5e:cf:18:80:05:4f:8e:37:64:1b:e2:e2:77:ee:74:
ea:93:29:77:88
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)
In either case, there's enough information to tell whether it's a key on Bitcoin's curve (secp256k1) or not. Assuming that it is, then you can just take what's in the
priv section, remove the colons, combine what remains into a single line, prepend a
0x, and feed that to the script I posted
here, like this:
$ python3 make_address.py 0x1f4288fbf073e425c07614ff9b8a2aa8c23ca410494d833136f81c25bef04486
(Before running the above command, I'd edit
make_address.py and change
show_p2pkh_uncompressed near the top of the script from
False to
True.)
That'll give you a set of three addresses, along with their WIFs:
+------+----------------------+
| Type | Legacy, Uncompressed |
+--+------+----------------------+-------------+
| Address | 178WCczMcyUWWbkTnWnL5xwFBmyRk3dVAA |
+---+---------+------------------------------------+----------------+
| Private Key | 5J445EQqLav3H5M8RsGgBHkJphHUXiQSJeNAiewQ8HJ68wVdpfi |
+-------------+-----------------------------------------------------+
+------+--------------------+
| Type | Legacy, Compressed |
+--+------+--------------------+---------------+
| Address | 1GV7eRheoT9RXEpEoSpL7yzSh5Wx9sCkBE |
+---+---------+------------------------------------+-----------------------+
| Private Key | p2pkh:KxGUZgCCMSh73xBqnktBvQv9fWoiWZkSgsvRtrT758vRg1GKywgA |
+-------------+------------------------------------------------------------+
+------+---------------+
| Type | Native SegWit |
+--+------+---------------+----------------------------+
| Address | bc1q48d3fd9dkrf237ldfa6d2qdpkaax5r72lqxqay |
+---+---------+--------------------------------------------+----------------+
| Private Key | p2wpkh:KxGUZgCCMSh73xBqnktBvQv9fWoiWZkSgsvRtrT758vRg1GKywgA |
+-------------+-------------------------------------------------------------+
(I know your example file isn't meant to lead to much balance, but, in general, you should obviously not share any of the above output, and you should try to do all of the above in a security-conscious way: offline, and in something amnesic like Tails.)