We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 65dbfa4 + 6eaff43 commit 700eec6Copy full SHA for 700eec6
iterative/utils/ssh.go
@@ -5,6 +5,7 @@ import (
5
"crypto/rsa"
6
"crypto/x509"
7
"encoding/pem"
8
+ "fmt"
9
"strings"
10
"time"
11
@@ -27,7 +28,11 @@ func PrivatePEM() (string, error) {
27
28
}
29
30
func PublicFromPrivatePEM(privateKey string) (string, error) {
- block, _ := pem.Decode([]byte(privateKey))
31
+ block, rest := pem.Decode([]byte(privateKey))
32
+ if block == nil {
33
+ return "", fmt.Errorf("Invalid PEM on the SSH private key: %#v", rest)
34
+ }
35
+
36
key, err := x509.ParsePKCS1PrivateKey(block.Bytes)
37
if err != nil {
38
return "", err
0 commit comments