Accept application/pkcs7-mime to parse certificate. (#4797)

When downloading a pkcs7 file to parse for issuer, some servers
appear to deliver application/pkcs7-mime Content-Type and others
application/x-pkcs-mime. This patch changes the conditional
to look for both to invoke parseCMS().
This commit is contained in:
Andrew Gabbitas 2020-04-29 14:44:16 -06:00 committed by GitHub
parent 2205300582
commit bf9b34cdf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -41,7 +41,8 @@ func getIssuer(cert *x509.Certificate) (*x509.Certificate, error) {
return nil, err
}
var issuer *x509.Certificate
if resp.Header.Get("Content-Type") == "application/x-pkcs7-mime" {
contentType := resp.Header.Get("Content-Type")
if contentType == "application/x-pkcs7-mime" || contentType == "application/pkcs7-mime" {
issuer, err = parseCMS(body)
} else {
issuer, err = parse(body)