Hello, is any way to get private key from bitcoin.com Windows wallet?
If I export BTC wallet with private key to file, I get this aes.json file
Is any way to decode only private key?
Yes... you can decrypt the wallet information. See detailed explanation below.
Did you use some decryption tool from the method above to extract the private keys?
Unfortunately, I don't think the old decryption tool (made for blockchain.info and/or multibit JSON formats) will work... it is a completely different format for the export file... and it is actually using a slightly different encryption mode (AES-256-CCM instead of AES-256-CBC) as well...
However, all is not lost!
I did some digging... and found that
the BitGo wallet uses this same format... and that the BitGo API supports decrypting the wallet file...
So, off to the BitGo GitHub I went... and discovered that
the bitgo.decrypt() call is ACTUALLY just calling the decrypt method in "SJCL" (Stanford Javascript Crypto Library)!
return sjcl.decrypt(params.password, params.input);
That makes our job sooooooo much easier... we can just import SJCL, then pass it the export password and export data!
So, how do we do that?
Well, firstly I created a test export from bitcoin.com wallet for windows... NOTE:
Password is: 123{"iv":"aE6b04cM1BcUMBesRei9+Q==","v":1,"iter":10000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"uSmPalXNcnA=","ct":"g5S6gbETdClu1e4hlcfmYPg04W367A0OpDSL3jYKEs76B5mXVnRBRY/VmodbHyhwaNvfc/aI1cjtqc57QJ3OLmFXyU0Y+XBJejAsIqLIIRXN5Ad42k38SmBy9j9XiTeoJGlLwtbVnExGlhovT0Yb7UiELHPaAxQUsvABC3Eo+tk86AcLEYhQWRuyCcjrJR+hHOz0iMoihV6WMgp7j3QYpD4arlDLDcwx9NtXuiUEYETTOX+ByQuYJVSuLlSw23WVzTtkqb+l3YAN0+zweS/JRdQGL/ep77R+xCtJLMnWcqRjLh2XVpzhkFCLbnVhVPDpV6CCg8OD5o9lB3GncDHHACU0f1FhrqNH/7lF6X5KnRlLPCys1BUuWHzaxwb5s5Nk7QXzFNLnAUw7tjgV2oGOhb/4NgBhELESzvv2eqOe1IUvPT1HOt3npZGYwiBIQgBu2CRzYlLIJ4DUKtrNFQjqg038ugbOq2hSo/QzqyLE/mP2Z0qMhTY6DBfiw1t8tfwGcis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kAbvnTvtFuZopcMfCYGpyfHN/vMktHOk/inaVMqlx1jrHJGkbVjeGTOElVQf70OdURa6s3qCMeaqJGuntVjJwRt4oD+o1pyda12FlajbZ7weZIVTd6XDIGJNUeYlJgqF3hav/tzTyB0sUnfsUX4+1E8cBBVzeW3rOM0cxCQ+T3uh0UntJLOXBBVGWK27hL0BTiMihypwMbaAkVC+se6d1EO6G1vfwLkU9UBMoIDmek454w=="}
Then, based on
what I learnt from Abdussamad regarding running javascript directly in the browser... I opened up the javascript console in Chrome (press F12)... and imported the SJCL library:
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/sjcl/1.0.8/sjcl.min.js';
document.head.appendChild(script);
Then imported the contents of wallet.aes.json into a variable called "encryptedString":
var encryptedString = '{"iv":"aE6b04cM1BcUMBesRei9+Q==","v":1,"iter":10000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"uSmPalXNcnA=","ct":"g5S6gbETdClu1e4hlcfmYPg04W367A0OpDSL3jYKEs76B5mXVnRBRY/VmodbHyhwaNvfc/aI1cjtqc57QJ3OLmFXyU0Y+XBJejAsIqLIIRXN5Ad42k38SmBy9j9XiTeoJGlLwtbVnExGlhovT0Yb7UiELHPaAxQUsvABC3Eo+tk86AcLEYhQWRuyCcjrJR+hHOz0iMoihV6WMgp7j3QYpD4arlDLDcwx9NtXuiUEYETTOX+ByQuYJVSuLlSw23WVzTtkqb+l3YAN0+zweS/JRdQGL/ep77R+xCtJLMnWcqRjLh2XVpzhkFCLbnVhVPDpV6CCg8OD5o9lB3GncDHHACU0f1FhrqNH/7lF6X5KnRlLPCys1BUuWHzaxwb5s5Nk7QXzFNLnAUw7tjgV2oGOhb/4NgBhELESzvv2eqOe1IUvPT1HOt3npZGYwiBIQgBu2CRzYlLIJ4DUKtrNFQjqg038ugbOq2hSo/QzqyLE/mP2Z0qMhTY6DBfiw1t8tfwGcisS52ZwOl8bnGknnlWIf97dtx2e55D69za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Ok/inaVMqlx1jrHJGkbVjeGTOElVQf70OdURa6s3qCMeaqJGuntVjJwRt4oD+o1pyda12FlajbZ7weZIVTd6XDIGJNUeYlJgqF3hav/tzTyB0sUnfsUX4+1E8cBBVzeW3rOM0cxCQ+T3uh0UntJLOXBBVGWK27hL0BTiMihypwMbaAkVC+se6d1EO6G1vfwLkU9UBMoIDmek454w=="}';
Then executed the .decrypt() method, passing in the export file password (password used was 123) and the "encryptedString" variable that we just created:
var decryptedString = sjcl.decrypt('123', encryptedString);
decryptedString.toString();
... et voilà!
"{"coin":"btc","network":"livenet","xPrivKey":"xprv9s21ZrQH143K4VZrA3w1qp44fNDNgeTNBKdt5f5MpBifWo78rbhP84w8qaTybdZsdmDFUExT2M4P4gxFDnEHCUq91AG1PjNXadWZPfvAEaf","xPubKey":"xpub6Bw8UNcpHwE6rWM6tQ1FQzvy5KX2vZeDfk3G49WFc19PSkuPKbRrbJSrJMRnJUQqopYKeQQgorpaUugvmEsnYbjgvojrdXUoJB5FU1vuCgc","requestPrivKey":"1755ea2209fa3a4e56b9f771de6db5088aaa82ae73aa3f34e9f3cb6fce30fa0a","requestPubKey":"0229d30db3ada53ee802eca52bf434ed25a4895610bf10535ebf1e88a63386e2db","copayerId":"f1d2eac1db62e2103e955d0bee7114cf0980de19a507f5c1a399378f0d8d47e2","publicKeyRing":[{"xPubKey":"xpub6Bw8UNcpHwE6rWM6tQ1FQzvy5KX2vZeDfk3G49WFc19PSkuPKbRrbJSrJMRnJUQqopYKeQQgorpaUugvmEsnYbjgvojrdXUoJB5FU1vuCgc","requestPubKey":"0229d30db3ada53ee802eca52bf434ed25a4895610bf10535ebf1e88a63386e2db"}],"walletId":"0d380f2b-f41e-4132-b614-dbd094903313","walletName":"My BTC Wallet","m":1,"n":1,"walletPrivKey":"f1a26f143543c9ef006c7b2a42d1cf576c25e8ce06dce0f496c4bd37e661b4a2","personalEncryptingKey":"XlgcaJ18PcxxSw9Ik2/YmQ==","sharedEncryptingKey":"JVkW3jRTA+b4Bja5srQv7Q==","copayerName":"me","mnemonic":"chronic indoor basket wrist urban base average peasant ensure park educate tower","entropySource":"00dfda1fc9a7fcda66898bb882de3ad6295c04c4e037b5efb070df3a60f1825b","mnemonicHasPassphrase":false,"derivationStrategy":"BIP44","account":0,"compliantDerivation":true,"addressType":"P2PKH","addressBook":[]}"
You can see it in action here:
As you can see, the decrypted file contains the xprv, xpub and also the 12 word mnemonic for the wallet... It's BIP39/BIP44 compatible, so you can use the mnemonic on
Ian Coleman's Mnemonic Code Converter to get all your addresses/keys... or even import it into a BIP39-compatible wallet.
Note, this should also work in Firefox (press CTRL+SHIFT+K to open Javascript console)...