Skip to content

Commit 979a1d5

Browse files
committed
fix: PKCS8 format private key validating issue #326
1 parent 1577eb1 commit 979a1d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/cert/helper.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ func IsPrivateKey(pemStr string) bool {
2727
}
2828

2929
_, errECDSA := x509.ParseECPrivateKey(block.Bytes)
30-
return errECDSA == nil
30+
if errECDSA == nil {
31+
return true
32+
}
33+
34+
_, errPKC := x509.ParsePKCS8PrivateKey(block.Bytes)
35+
return errPKC == nil
3136
}
3237

3338
// IsCertificatePath checks if the file at the given path is a certificate or not exists.

0 commit comments

Comments
 (0)