From f59071ff1c2da7f03cd58b626f2267ab14905352 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 28 Jan 2022 17:23:01 +0000 Subject: [PATCH] Trim whitespace from privateKey before parsing --- app.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index b9d570c5..3ba384b9 100644 --- a/app.go +++ b/app.go @@ -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 {