How to restore backup from .bin file programmatically

Started by madforstrength, June 22, 2016, 06:16:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

svk

Quote from: madforstrength on June 27, 2016, 11:50:33 AM
yup I know that, but the problem is I am getting encrypted brainkey with an encryption key but i dont know what type of encryption is that. :(

DO you know anyone in this forum who can guide me about it? who knows how gui wallet works?

@jcalfee1 is the one who wrote the code for it, I haven't looked too much at this part myself.

Found this though:

var brainkey_plaintext = aes_private.decryptHexToText( wallet.encrypted_brainkey )

aes_private is an instance of Aes, the method decryptHexToText can be found here:

https://github.com/svk31/graphenejs-lib/blob/master/lib/ecc/src/aes.js#L228
Worker: dev.bitsharesblocks

madforstrength

yup I know that, but the problem is I am getting encrypted brainkey with an encryption key but i dont know what type of encryption is that. :(

DO you know anyone in this forum who can guide me about it? who knows how gui wallet works?

xeroc

Quote from: madforstrength on June 27, 2016, 11:29:01 AM
Hi @xeroc can you tell me how can i decrypt encrypted private keys?

Also I got encrypted brain key alongwith its encryption key, would appreciate if you can tell me to decrypt brainkey as well.

Thanks
I don't know many details about how the GUI encrypts the wallet.
But once you have a brain key (12 english words) you can use the BrainKey object in graphenebase.account (https://github.com/xeroc/python-graphenelib/blob/master/graphenebase/account.py#L47-L65) to get the private key(s)

madforstrength

Hi @xeroc can you tell me how can i decrypt encrypted private keys?

Also I got encrypted brain key alongwith its encryption key, would appreciate if you can tell me to decrypt brainkey as well.

Thanks

xeroc

Quote from: madforstrength on June 22, 2016, 11:25:18 AM
Yes @xeroc I have been trying to reverse engineer its decryptWalletBackup method.
Can you tell me python/graphene equivalent of this method ?

PublicKey.fromBuffer


Erm .. it would probably be something like this

from graphenebase.account import PublicKey
frim binascii import unhexlify
b = rawPublicKey
pubKey = PublicKey(unhexlify(b))

madforstrength

Yes @xeroc I have been trying to reverse engineer its decryptWalletBackup method.
Can you tell me python/graphene equivalent of this method ?

PublicKey.fromBuffer


madforstrength

@xeroc , This is the backup file that we export from webwallet, it is importing fine in other webwallet as well as desktop wallet.

What I am trying to do is adding "import from backup .bin file" functionality in my application. So I was wondering if you or someone can tell me how this file is decoded to get wallet json keys.

xeroc

Quote from: madforstrength on June 22, 2016, 06:16:36 AM
@xeroc Hi again,

Can you tell me if python-graphenelib has any method to import backup from bin file?
Nop. Don't even know what format that is.

Quote
Or any other way I can import backup from bin file in my wallet?
Where did you get that file? Does it not load in the Web wallet?

madforstrength

@xeroc Hi again,

Can you tell me if python-graphenelib has any method to import backup from bin file?

Or any other way I can import backup from bin file in my wallet?

Thanks and Regards