Better error messages for parseCert() (#39)

This commit is contained in:
Tom D 2019-06-12 10:11:18 -07:00 committed by GitHub
parent 8ac2846c80
commit 8afa43fc13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,11 +153,11 @@ func parseCert(ekCert []byte) (*x509.Certificate, error) {
Raw asn1.RawContent
}
if _, err := asn1.Unmarshal(ekCert, &cert); err != nil {
return nil, err
return nil, fmt.Errorf("asn1.Unmarshal() failed: %v", err)
}
c, err := x509.ParseCertificate(cert.Raw)
if err != nil && x509.IsFatal(err) {
return nil, err
return nil, fmt.Errorf("x509.ParseCertificate() failed: %v", err)
}
return c, nil
}