[keys] Improve passphrase sanitization when read from file

pull/223/head
Janet Liang 5 years ago
parent aa1257aa5e
commit bafa409e03
  1. 4
      cmd/subcommands/keys.go

@ -53,7 +53,9 @@ func getPassphrase() (string, error) {
if err != nil {
return "", err
}
pw := strings.TrimSuffix(string(dat), "\n")
pw := strings.ReplaceAll(string(dat), "\n", "")
pw = strings.ReplaceAll(pw, "\t", "")
pw = strings.TrimSpace(pw)
return pw, nil
} else if userProvidesPassphrase {
fmt.Println("Enter passphrase:")

Loading…
Cancel
Save