diff --git a/cmd/ethkey/changepassword.go b/cmd/ethkey/changepassword.go index 97a3047c6fed8536904b44046bfc9197fef2f1b1..16b88ae6e5f67af8aa308fbbacf0650614722396 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 2b648b14a940d06b4bf714de211d09fa1301318f..8a2038dd7315e10196051da154eed91261074d61 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 4cf7e8f0113f4ae87c3035356f3a004eea27be99..63ebf1d6f8f41b5f19ba9e894934f017eb125540 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 2d85e8edeb2c076463531e049cd66c428975bb2e..3429fa93130f8c9d63087c0f15291943295a2376 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 bc46b71b63251f0d14aa61435cf9ab517110e0a0..0f3c39c298ba3859cca8ee56a686a0f80157a332 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