mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
smx509: ParseCertificatePEM validate type
This commit is contained in:
parent
1aefd6f1f6
commit
c9f55b045f
@ -1063,7 +1063,7 @@ func ParseCertificates(der []byte) ([]*Certificate, error) {
|
||||
|
||||
func ParseCertificatePEM(data []byte) (*Certificate, error) {
|
||||
block, _ := pem.Decode(data)
|
||||
if block == nil {
|
||||
if block == nil || block.Type != "CERTIFICATE" {
|
||||
return nil, errors.New("x509: failed to decode PEM block containing certificate")
|
||||
}
|
||||
return ParseCertificate(block.Bytes)
|
||||
|
Loading…
x
Reference in New Issue
Block a user