We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cd7c9a5 + 0f27727 commit b4cbb99Copy full SHA for b4cbb99
1 file changed
internal/store/private_key.go
@@ -5,10 +5,12 @@ import (
5
"crypto/x509"
6
"encoding/pem"
7
"errors"
8
+ "reflect"
9
+
10
"github.com/misha-ssh/kernel/internal/logger"
11
"github.com/misha-ssh/kernel/internal/storage"
12
"github.com/misha-ssh/kernel/pkg/connect"
- "reflect"
13
+ "golang.org/x/crypto/ssh"
14
)
15
16
var (
@@ -26,6 +28,10 @@ func validatePrivateKey(privateKey string) error {
26
28
return ErrNotValidPrivateKey
27
29
}
30
31
+ if _, err := ssh.ParseRawPrivateKey([]byte(privateKey)); err == nil {
32
+ return nil
33
+ }
34
35
_, err := x509.ParsePKCS1PrivateKey(block.Bytes)
36
if err != nil {
37
key, err := x509.ParsePKCS8PrivateKey(block.Bytes)
0 commit comments