20

I want to import my private key from the android's Bitcoin Wallet (the one created by Andreas Schildbach) but it can export it only in an encrypted way.

How do I decrypt the file so I can import the key to my Bitcoin Qt?

1

5 Answers 5

24

from: https://github.com/schildbach/bitcoin-wallet/tree/master/wallet

The backup file is encrypted using your chosen password. You can use OpenSSL to decrypt:

openssl enc -d -aes-256-cbc -a -in <filename>
1
4

If anyone is trying this in 2017, openssl has now defaulted to use SHA256 instead of the MD5 assumed in the older answers. Add "-md md5" (no quotes) to your openssl command line string.

https://superuser.com/questions/1245384/openssl-bad-decrypt-between-0-9-8o-and-1-1-0f

For example, originally without that MD5 option I was seeing:

$openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-backup-2017-09-28 -out decrypted
enter aes-256-cbc decryption password: ******
bad decrypt
140031244338432:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:../crypto/evp/evp_enc.c:535:

But then with the MD5 option:

$openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-backup-2017-09-28 -out decrypted -md md5
enter aes-256-cbc decryption password: ******

It runs successfully and creates a file called "decrypted" which is mostly binary data but starts with ^Vorg.bitcoin.production^R and contains your 12 word mnemonic as text near the top of the file.

2
  • In this case simply use the openssl-1.0 bindings which enforces the old encoding that changed when using recent version 2 binaries: openssl-1.0 enc -d -aes-256-cbc -a -in bitcoin-wallet-backup-2017-09-28
    – mschmoock
    Dec 4, 2017 at 15:55
  • I got a warning *** WARNING : deprecated key derivation used. Using -iter or -pbkdf2 would be better. but the decryption of the secret keys worked fine, though!
    – Leder
    Jan 27, 2021 at 10:29
1

This script seems to do the work

https://github.com/jleni/wallet-decrypt

You just need to create a backup and it will give you back a mnemonic that you can use in electrum or electrum cash.

0

This guide was the only one that worked for me. The mnemonic phrase didn't work on Electrum nor Electron Cash, but the exported private key as described here did:

https://bitcointalk.org/index.php?topic=2061691.0

-1

I go a bit fancier:

set /p xin=
set xout="%xin%.txt"
openssl enc -d -aes-256-cbc -a -in "%XIN%" -out %XOUT% 

But basically you want to name a file for the output and also the -k flag allows PASSWORD directly to be entered, like so:

openssl enc -d -aes-256-cbc -a -in "INFILE" -out "OUTFILE.txt" -k PASSWORD ,

where CAPS is the variable. Save above 3 lines or single openssl cmd into a *.bat (WinBatch file)

2
  • Im not understand about " save above 3 lines or . . . . " because my result outfile.txt words cannot read . Excample " ãíâVÏ7@ãíâVÏ7@ " Thank you .
    – user27565
    Jul 22, 2015 at 5:10
  • @SekeratKejunG See this gist. The 3 lines are a batch file. You can just skip straight to openssl enc -d -aes-256-cbc -a -in "encrypted" -out "decrypted.txt". encrypted is the base64 AES encrypted text file, decrypted.txt will be a Litecoin wallet in text. If the files in the gist decrypt but your wallet isn't decrypting, then something else is wrong Jul 22, 2015 at 8:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.