1
0
mirror of synced 2026-02-13 21:16:57 +00:00

Correctly load private key by not decoding PEM 2x

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals
2021-04-09 09:59:44 +02:00
parent bce0da2806
commit 5f9dd7a5a5
4 changed files with 80 additions and 7 deletions

View File

@@ -18,7 +18,6 @@ package sourcesecret
import (
"bytes"
"encoding/pem"
"fmt"
"io/ioutil"
"net"
@@ -131,12 +130,7 @@ func loadKeyPair(path string) (*ssh.KeyPair, error) {
return nil, fmt.Errorf("failed to open private key file: %w", err)
}
block, _ := pem.Decode(b)
if block == nil {
return nil, fmt.Errorf("failed to decode PEM block")
}
ppk, err := cryptssh.ParsePrivateKey(block.Bytes)
ppk, err := cryptssh.ParsePrivateKey(b)
if err != nil {
return nil, err
}