How to decode private key from Android Bitcoin Wallet?



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?


Posted 2013-11-23T23:58:30.873

Reputation: 350




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

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


Posted 2013-11-23T23:58:30.873

Reputation: 442


The instructions have been moved to:

– Justin Harris – 2017-07-02T18:26:40.947


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.

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.


Posted 2013-11-23T23:58:30.873

Reputation: 21

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 – 2021-01-27T10:29:02.413

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  – 2017-12-04T15:55:46.667


This script seems to do the work

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

Juan Leni

Posted 2013-11-23T23:58:30.873

Reputation: 337


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:


Posted 2013-11-23T23:58:30.873

Reputation: 101


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)

Wizard Of Ozzie

Posted 2013-11-23T23:58:30.873

Reputation: 4 920

Im not understand about " save above 3 lines or . . . . " because my result outfile.txt words cannot read . Excample " ãíâVÏ7@ãíâVÏ7@ " Thank you . – None – 2015-07-22T05:10:18.033

@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

– Wizard Of Ozzie – 2015-07-22T08:48:55.507