Bitcoin Forum
May 23, 2019, 04:25:07 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to decode an encrypted WIF key ?  (Read 214 times)
Crypto_FM91
Newbie
*
Offline Offline

Activity: 7
Merit: 2


View Profile
March 05, 2019, 12:18:51 PM
 #1

H,

Please can you tell me how to get "Private key (WIF key)" from an "AES-256 Encrypted WIF key" ?
I have created a BTG adress on coinb.in, I have the AES-256 Encrypted WIF key and my password but I do not know how to decode it.

Thank you.
1558628707
Hero Member
*
Offline Offline

Posts: 1558628707

View Profile Personal Message (Offline)

Ignore
1558628707
Reply with quote  #2

1558628707
Report to moderator
1558628707
Hero Member
*
Offline Offline

Posts: 1558628707

View Profile Personal Message (Offline)

Ignore
1558628707
Reply with quote  #2

1558628707
Report to moderator
1558628707
Hero Member
*
Offline Offline

Posts: 1558628707

View Profile Personal Message (Offline)

Ignore
1558628707
Reply with quote  #2

1558628707
Report to moderator
GET 25 FREE SPINS AT REGISTRATION
GET 100% BONUS ON FIRST DEPOSIT
PLAY NOW
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1558628707
Hero Member
*
Offline Offline

Posts: 1558628707

View Profile Personal Message (Offline)

Ignore
1558628707
Reply with quote  #2

1558628707
Report to moderator
mocacinno
Legendary
*
Offline Offline

Activity: 1596
Merit: 1587


https://unblur.ninja =>lightning network testsite


View Profile WWW
March 05, 2019, 12:26:37 PM
 #2

I don't really have time for a complete explanation (late for a meeting), but if you download the sourcecode of https://www.bitaddress.org/ from github, disconnect your pc from the internet, open the main page, go to wallet details and enter WIF + pass, you should get all other formats as output

nc50lc
Sr. Member
****
Offline Offline

Activity: 602
Merit: 396


Self-proclaimed Genius ㊙️


View Profile WWW
March 05, 2019, 12:48:06 PM
Merited by vapourminer (1), BitMaxz (1)
 #3

Let me add the details:

  • 1. Go to bitaddress' Github page: https://github.com/pointbiz/bitaddress.org and download the source (zip).
  • 2. Turn off your internet connection, Extract and open it (drag&drop bitaddress.org.html) to your browser.
  • 3. Move your mouse until the 1st address reach 100%, then click "Wallet Details".
  • 4. Check "BIP38 Encrypt?", enter your encrypted key and passphrase, hit "Encrypt BIP38" (sometimes, it changes to "Decrypt" after clicking).
  • 5. After loading, your WIF private key should show up.

Image: (Random key from the internet: please don't import)


███████████
██
██
██
██
██
██
██
██
██
██
██
███████████
#1
███████████
██
██
██
██
██
██
██
██
██
██
██
███████████
BTC 
  ●
   BTC
  BTC   
.
    ▄▄▄▀▀▀▀
 ▄██▀
███        ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▄
▀███▄▄▄▄▀▀▀                 ▀▀▄▄
  ▀▀▀██████████████████████████▀
   ▄█▄     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
    ▀▀██▄▄█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀
      ▄  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
      ▀██▄  ▄▀▀▀▀▀▀▀▀▀▀▀▀▄
        ▀█▀██████████████▀▀
         ▀█▄▄ ▄▄▄▄▄▄▄▄▄▄
            █▀▄▄▄▄▄▄▄▄▄▄▀
             ▀▀▄▄▄▄▄▄▄
.
     BTC
  BTC   
  ●
  BTC   
███████████
██
██
██
██
██
██
██
██
██
██
██
███████████
███████████
██
██
██
██
██
██
██
██
██
██
██
███████████
Crypto_FM91
Newbie
*
Offline Offline

Activity: 7
Merit: 2


View Profile
March 05, 2019, 07:42:38 PM
Last edit: March 05, 2019, 08:04:55 PM by Crypto_FM91
Merited by LoyceV (1)
 #4

Hi,
Many thanks for your help. I tryed both but my encrypted WIF key is not recognised. I got the message bellow
" The text you entered is not a valid Private Key! Would you like to use the entered text as a passphrase and create a Private Key using a SHA256 hash of the passphrase?"

The encrypted WIF key I am talking about is for Bitcoin Gold. It has 108 characters.

Here is an example of an encrypted wif key and it's corresponding wif key and password that i have generated here (https://coinb.in/#newAddress) for testing purpose
WIF key : "KyYEjVKDcbUrgfrpdpzaZBm1szWbzTmrBvxsQzDWgCAAZnd6uw8S"
AES-256 Encrypted WIF key : "U2FsdGVkX187FiUTQ0lMNeO5AkYQS9xU874h0g4AWch3ZfLuKEiUndejRQ0uRGw03sY5tOlTiVyiLf4 oax+6IGF7hJUAjOMEomCGOxd8jvg="
Password : "123"
BitMaxz
Legendary
*
Offline Offline

Activity: 1442
Merit: 1174


Bitmain miners is getting worst.


View Profile WWW
March 05, 2019, 09:19:39 PM
Last edit: March 05, 2019, 10:24:19 PM by BitMaxz
 #5

I think you need OpenSSL for this to decrypt your AES-256 Encrypted WIF key.

Anyway, Let me test if I can decrypt your encrypted WIF key.

Edit:
It seems OpenSSL doesn't work to me or there is something wrong with my command.

I used this command

Code:
enc -d -aes-256-cbc -p -md md5 -a -in plain1.txt -out plaind1.txt
The encrypted wif key I just paste it inside the plain1.txt

But the result is an "error reading input file".

I think we need to know if what cipher type that coinb.in used?

Abdussamad
Legendary
*
Offline Offline

Activity: 2114
Merit: 1147



View Profile WWW
March 05, 2019, 10:25:34 PM
Last edit: March 05, 2019, 10:50:13 PM by Abdussamad
Merited by suchmoon (4), BitMaxz (2), HCP (2), vapourminer (1)
 #6

Edit: Actually you can use your browser's developer tools to decrypt the priv key. For example on firefox ctrl+shift+k should bring up the js console. There you can decrypt the priv key with the following code:

Code:
var mencrypted = "enter encrypted priv key here";
var mpassword = "enter password here";
var decrypted = CryptoJS.AES.decrypt(mencrypted, mpassword);
alert(decrypted.toString(CryptoJS.enc.Utf8));

Source

BitMaxz
Legendary
*
Offline Offline

Activity: 1442
Merit: 1174


Bitmain miners is getting worst.


View Profile WWW
March 05, 2019, 11:15:22 PM
 #7

Edit: Actually you can use your browser's developer tools to decrypt the priv key. For example on firefox ctrl+shift+k should bring up the js console. There you can decrypt the priv key with the following code:

Code:
var mencrypted = "enter encrypted priv key here";
var mpassword = "enter password here";
var decrypted = CryptoJS.AES.decrypt(mencrypted, mpassword);
alert(decrypted.toString(CryptoJS.enc.Utf8));

Source
I tried as your suggestion it doesn't work in firefox it always shows "ReferenceError: CryptoJS is not defined"

Look at the reference below.

HCP
Legendary
*
Offline Offline

Activity: 980
Merit: 1507

<insert witty quote here>


View Profile
March 05, 2019, 11:29:26 PM
Merited by suchmoon (4), Welsh (2), BitMaxz (2), vapourminer (1), ETFbitcoin (1)
 #8

Edit: Actually you can use your browser's developer tools to decrypt the priv key.
Took some messing around to make this work on Chrome (Press F12 to get console)... It doesn't seem to have the CryptoJS stuff auto imported? Huh

I had to first of all copy/paste this code snippet into the console to get access to the CryptoJS library... the source code for which is no longer available on code.google.com Undecided So, I'm using some random link I found while googling for it Tongue
Code:
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js';
document.head.appendChild(script);

Then, I could copy/paste the following code into the console and it would pop up the alert showing the private key.
Code:
var mencrypted = "enter encrypted priv key here";
var mpassword = "enter password here";
var decrypted = CryptoJS.AES.decrypt(mencrypted, mpassword);
alert(decrypted.toString(CryptoJS.enc.Utf8));


If you try and copy/paste the whole lot in one go... it'll complain that CryptoJS doesn't exist:
Quote
Uncaught ReferenceError: CryptoJS is not defined
    at <anonymous>:8:17
But, if you just copy/paste it again, it'll work...


What is interesting, is that I attempted to use the OPs example:
Code:
Here is an example of an encrypted wif key and it's corresponding wif key and password that i have generated here (https://coinb.in/#newAddress) for testing purpose
WIF key : "KyYEjVKDcbUrgfrpdpzaZBm1szWbzTmrBvxsQzDWgCAAZnd6uw8S"
AES-256 Encrypted WIF key : "U2FsdGVkX187FiUTQ0lMNeO5AkYQS9xU874h0g4AWch3ZfLuKEiUndejRQ0uRGw03sY5tOlTiVyiLf4oax+6IGF7hJUAjOMEomCGOxd8jvg="
Password : "123"
And I just get a blank alert... but when I use a randomly generated one from coinb.in... it works!

Code:
WIF Key : "L3pLNp7KgZAT2LSuue4RPkum6XGCgeZFE2Dk37xPvxnN8TAEtQX1"
AES-256 Encrypted WIF key : "U2FsdGVkX1/fN3CAnYeGfVPhdq8G/MM+u8U4K7nR1xm3iHwXQwOojQmzyF3Zp/e4N5l8T+iNFSw8OGxC5P67+Jil8HR/Tb64QJfX0qUDxSg="
Password : "123"

I'm guessing the OPs example is broken? bad AES encrypted key or bad password? Huh




EDIT:

I tried as your suggestion it doesn't work in firefox it always shows "ReferenceError: CryptoJS is not defined"
I was getting the same... I think maybe Abdussamad already had the CryptoJS stuff loaded (browser extension maybe?)... try running my little code snippet to load the aes.js script and see if that helps! Wink

pooya87
Legendary
*
Offline Offline

Activity: 1652
Merit: 1652



View Profile
March 06, 2019, 05:01:40 AM
Merited by BitMaxz (2)
 #9

I tried as your suggestion it doesn't work in firefox it always shows "ReferenceError: CryptoJS is not defined"
I was getting the same... I think maybe Abdussamad already had the CryptoJS stuff loaded (browser extension maybe?)... try running my little code snippet to load the aes.js script and see if that helps! Wink

open https://coinb.in/ website first and then bring up the browser's inspect window (developers tool or whatever else it is called in other browsers) and then type those commands in. when you open the site, CryptoJS is already loaded that way you don't have to go through the trouble of manually loading anything.

BitMaxz
Legendary
*
Offline Offline

Activity: 1442
Merit: 1174


Bitmain miners is getting worst.


View Profile WWW
March 06, 2019, 05:05:22 PM
Merited by ETFbitcoin (1)
 #10

Both of them works @HCP method you just need to use this code first .

Code:
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js';
document.head.appendChild(script);

Before we insert Abdussamad code.

And now it works fine it shows the wif key on the screen.

For the pooya87 suggestion, it also works.

Just we need to send the Abdussamad code while you are in coinb.in website page.

What I did lately is I just send the code from Abdussamad to a new tab that is why I see bad result "ReferenceError: CryptoJS is not defined"

Abdussamad
Legendary
*
Offline Offline

Activity: 2114
Merit: 1147



View Profile WWW
March 06, 2019, 05:07:45 PM
 #11

Yeah sorry I didn't mention that the site had to be loaded first. Kinda forgot Tongue

Crypto_FM91
Newbie
*
Offline Offline

Activity: 7
Merit: 2


View Profile
March 06, 2019, 06:08:43 PM
Last edit: March 06, 2019, 09:36:55 PM by Crypto_FM91
Merited by BitMaxz (1)
 #12

Hi,

THANK YOU VERY MUCH, IT WORKS !!! I have successfully unlocked my BTG's .
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!