Safe to derive wallet address and private key from password using keythereum?

codewithcheesecodewithcheese Member Posts: 3
Hi

I am intertested in deriving my wallet address and private key from values I can remember, that way I do not need to be copying key files to different devices. Can someone please comment of on the security of my approach?
var keythereum = require("keythereum");
var password = 'this is a long password that should be memorable'; // what should be the minimum length if only alpha numeric?
var salt = '[email protected]';
var iv = ???; // can the iv be a constant? will the private key be reproducible if it dynamic? what format should it be?
var options = {
kdf: "pbkdf2",
cipher: "aes-128-ctr",
kdfparams: {
c: 262144,
dklen: 32,
prf: "hmac-sha256"
}
};
var privateKey = keythereum.deriveKey(password, salt, options);
var keyObject = keythereum.dump(password, privateKey, salt, iv, options);
keythereum.exportToFile(keyObject, '/home/username/.ethereum/keystore/');
Thanks for any and all criticism and commentary!

Comments

  • revcrevc Member Posts: 72
    Waitwaitwait.
    If this is similar to a Bitcoin "brain wallet" it's a horrible idea.
    Google "bitcoin brain wallet" to see why, it's pretty well documented.
  • codewithcheesecodewithcheese Member Posts: 3
    Thanks, I hadn't heard of bitcoin brain wallets before. Reading up on it now.

    I think this idea of wallet that you can recover from memorable information is not horrible only if the implementation is secure, it seems bitcoins brain wallet was indeed very insecure.

    This post describes some of the approaches and challenges around deriving keys from memorable information. It seems like if you use a salt and a configurably slow key derivation function you can expect some level of security. crypto.stackexchange.com/a/1665
  • codewithcheesecodewithcheese Member Posts: 3
    After reading the literature, I've come to the conclusion that humans can generally not be relied upon to create a password with enough entropy to withstand a offline attack. Using a key derivation function with a very high iteration count can help, but makes it very time consuming to regenerate on thinner devices such as smart phones.
Sign In or Register to comment.