Skip to content

Commit

Permalink
Slice off leading and trailing white space of key
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Dec 26, 2020
1 parent b4d10bc commit b61ded0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ func getKey(password, symmetricKeyFile string, saltFunc func() ([]byte, error))
if err != nil {
return nil, fmt.Errorf("failed to read %s: %w", symmetricKeyFile, err)
}
return key, nil
return bytes.TrimSpace(key), nil
}
if os.Getenv(pbgopySymmetricKeyFileEnv) != "" {
key, err := ioutil.ReadFile(os.Getenv(pbgopySymmetricKeyFileEnv))
if err != nil {
return nil, fmt.Errorf("failed to read %s: %w", symmetricKeyFile, err)
}
return key, nil
return bytes.TrimSpace(key), nil
}
return nil, nil
}

0 comments on commit b61ded0

Please sign in to comment.