Skip to content

Commit

Permalink
fix: PKCS8 format private key validating issue #326
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Mar 14, 2024
1 parent 1577eb1 commit 979a1d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/cert/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func IsPrivateKey(pemStr string) bool {
}

_, errECDSA := x509.ParseECPrivateKey(block.Bytes)
return errECDSA == nil
if errECDSA == nil {
return true
}

_, errPKC := x509.ParsePKCS8PrivateKey(block.Bytes)
return errPKC == nil
}

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

0 comments on commit 979a1d5

Please sign in to comment.