Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keystore parsing to obtain privatekey error #4

Open
YLeaves opened this issue Mar 1, 2021 · 0 comments
Open

Keystore parsing to obtain privatekey error #4

YLeaves opened this issue Mar 1, 2021 · 0 comments

Comments

@YLeaves
Copy link

YLeaves commented Mar 1, 2021

Hello! I tested a json recovery and found that the private key is incomplete and only 26 bytes long.

let password = "12345678"
let jsonStr = "{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"2670bec226095538fd44b50807a139d9"},"ciphertext":"50e9f70d396c8c0b7be1340673044fd78dfd493b19f746e14723222e395dc642","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"efdcd42c943a035377aaa481eb6dd33804a4c1b1fb392abf8aaa17695c672497"},"mac":"25201baf9cd2223580b8c393bdb5cfaa804c4daae2726e87bf053f9fca5563df"},"id":"c469d83a-378e-4470-94f0-81b663e39e19","version":3,"address":"9187e0a616a1a369ce6ca91d1026ec3583173d8a"}"

let jsonData = Data(jsonStr.utf8);
let keystore = try? JSONDecoder().decode(Keystore.self, from: jsonData)
let private = try? keystore?.privateKey(password:password )
let privateKey = private!.toHexString()
//print data
//privateKey:e8d90e0aae25d4e1523636cefd6f519856c4d99a57b4e046e540

Correct data
//privateKey:e8d90e0aae25d4e1523636cefd6f519856c4d99a57b4e046e5400e5c8b9f9506
//mnemonic:furnace vanish vicious misery very visual practice middle lonely actress speak zone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant