Post
Topic
Board Development & Technical Discussion
Merits 2 from 2 users
Topic OP
Extracting Privat Key from PEM File
by
Gantz87
on 15/01/2021, 13:48:40 UTC
⭐ Merited by NotATether (1) ,ETFbitcoin (1)
Hello there,

I have a problem with extracting an Privat Key from an old wallet (*.pfx).

In 2011 I convert a Wallet in this (OpenSSL PEM) format. In an old Post i can see the answer, but my programming skill is weak: https://bitcointalk.org/index.php?topic=2631.0

1. I use OpenSSL for Resieving the Privat Key:
openssl pkcs12 -in mywallet.pfx -nocerts -out privatekey.pem -nodes

2. Open the *.pem (I used the public key from the Topic above  Wink ):
-----BEGIN PRIVATE KEY-----
MIH1MIGuBgcqhkjOPQIBMIGiAgEBMCwGByqGSM49AQECIQD/////////////////
///////////////////+///8LzAGBAEABAEHBEEEeb5mfvncu6xVoGKVzocLBwKb
/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIh
AP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABJJ6TBhmiWm4
Y1ACBVJVn0oyG9Ay5IzEZq8cPyrs1PERl963YQh5UrGOT0NodynfHswkz8bUpaJW
FsowR/l9wXc=
-----END PRIVATE KEY-----


As I understand it, I have to do the following steps :

- computes the sha256 of the key ;
- computes the rmd160 of this hash ;
- add a byte at the begin for the version number (?) ;
- add four bytes at the end for the check sum ;
- encode the result in base58 ;


How can I do that with CMD and Editor? Is this the right way to get the correct bitcoin address?

Thanks for help.