Trim whitespace from privateKey before parsing

This commit is contained in:
Kristoffer Dalby 2022-01-28 17:23:01 +00:00
parent 4d60aeae18
commit f59071ff1c

3
app.go
View File

@ -724,7 +724,8 @@ func readOrCreatePrivateKey(path string) (*key.MachinePrivate, error) {
return nil, fmt.Errorf("failed to read private key file: %w", err)
}
privateKeyEnsurePrefix := PrivateKeyEnsurePrefix(string(privateKey))
trimmedPrivateKey := strings.TrimSpace(string(privateKey))
privateKeyEnsurePrefix := PrivateKeyEnsurePrefix(trimmedPrivateKey)
var machineKey key.MachinePrivate
if err = machineKey.UnmarshalText([]byte(privateKeyEnsurePrefix)); err != nil {