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?
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
The backup file is encrypted using your chosen password. You can use OpenSSL to decrypt: openssl enc -d -aes-256-cbc -a -in <filename>
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.
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.
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:
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)