Post
Topic
Board Development & Technical Discussion
Re: Extracting Privat Key from PEM File
by
HCP
on 19/01/2021, 02:40:48 UTC
do you know if you can get to enter the password with bc_key for the wallet.dat file.
i get this error with bc_key, you might know why,

read EC key
unable to load Key
140245723776704:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:707:Expecting: ANY PRIVATE KEY
bc_key doesn't work with "encrypted" wallet.dat files...


Quote
and this with ssl
openssl pkcs12 -in mywallet.dat -nocerts -out privatekey.pem -nodes
140391597541056:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1200:
140391597541056:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:374:Type=PKCS12
A standard "wallet.dat" (from Bitcoin Core) is not in a format that openssl can read/understand. A wallet.dat is a BerkeleyDB binary file... and if the wallet.dat has a password  on it, then the private key data will be encrypted.

If you have a wallet.dat, the best way to recover data from it is by opening a copy of the wallet.dat with a fully synced Bitcoin Core... attempting to open it with other utilities may damage the file or just not work.