diff --git a/cmd/ethkey/changepassword.go b/cmd/ethkey/changepassword.go index 32fde4ed6daffa5f8a5c31be8bd2d38dfb377e38..efff83d83651f493181f249451c783ec837085c8 100644 --- a/cmd/ethkey/changepassword.go +++ b/cmd/ethkey/changepassword.go @@ -51,7 +51,7 @@ Change the password of a keyfile.`, } // Decrypt key with passphrase. - passphrase := getPassphrase(ctx) + passphrase := getPassphrase(ctx, false) key, err := keystore.DecryptKey(keyjson, passphrase) if err != nil { utils.Fatalf("Error decrypting key: %v", err) diff --git a/cmd/ethkey/generate.go b/cmd/ethkey/generate.go index 09b00cc9dc1cbd0bbc9f8dd818a6dcc7f3d9b2bc..c2aa1c6fb4a9e44dfd302d284570c90b3f9965f9 100644 --- a/cmd/ethkey/generate.go +++ b/cmd/ethkey/generate.go @@ -94,7 +94,7 @@ If you want to encrypt an existing private key, it can be specified by setting } // Encrypt key with passphrase. - passphrase := promptPassphrase(true) + passphrase := getPassphrase(ctx, true) scryptN, scryptP := keystore.StandardScryptN, keystore.StandardScryptP if ctx.Bool("lightkdf") { scryptN, scryptP = keystore.LightScryptN, keystore.LightScryptP diff --git a/cmd/ethkey/inspect.go b/cmd/ethkey/inspect.go index ba03d4d93692c04a304b84845c0bdba373335c48..b646e43aa576a556d8127ae3252f93b2b1b28fe6 100644 --- a/cmd/ethkey/inspect.go +++ b/cmd/ethkey/inspect.go @@ -60,7 +60,7 @@ make sure to use this feature with great caution!`, } // Decrypt key with passphrase. - passphrase := getPassphrase(ctx) + passphrase := getPassphrase(ctx, false) key, err := keystore.DecryptKey(keyjson, passphrase) if err != nil { utils.Fatalf("Error decrypting key: %v", err) diff --git a/cmd/ethkey/message.go b/cmd/ethkey/message.go index 5caea69ff6536ce16d7350c38bad9a4d86a8e8e5..69c8cf0923923b194cb2bd67eef7745f473134da 100644 --- a/cmd/ethkey/message.go +++ b/cmd/ethkey/message.go @@ -62,7 +62,7 @@ To sign a message contained in a file, use the --msgfile flag. } // Decrypt key with passphrase. - passphrase := getPassphrase(ctx) + passphrase := getPassphrase(ctx, false) key, err := keystore.DecryptKey(keyjson, passphrase) if err != nil { utils.Fatalf("Error decrypting key: %v", err) diff --git a/cmd/ethkey/utils.go b/cmd/ethkey/utils.go index 7b5a144c538fd4965bc0e238611d4ceb22474804..1863bbda84691db9359e6ecd75e59cab6a897fcc 100644 --- a/cmd/ethkey/utils.go +++ b/cmd/ethkey/utils.go @@ -52,7 +52,7 @@ func promptPassphrase(confirmation bool) string { // getPassphrase obtains a passphrase given by the user. It first checks the // --passfile command line flag and ultimately prompts the user for a // passphrase. -func getPassphrase(ctx *cli.Context) string { +func getPassphrase(ctx *cli.Context, confirmation bool) string { // Look for the --passwordfile flag. passphraseFile := ctx.String(passphraseFlag.Name) if passphraseFile != "" { @@ -65,7 +65,7 @@ func getPassphrase(ctx *cli.Context) string { } // Otherwise prompt the user for the passphrase. - return promptPassphrase(false) + return promptPassphrase(confirmation) } // signHash is a helper function that calculates a hash for the given message