diff --git a/certhelper/key.go b/certhelper/key.go index a4e811f..8a055e0 100644 --- a/certhelper/key.go +++ b/certhelper/key.go @@ -11,6 +11,7 @@ import ( const ( rsaPrivateKeyPEMBlockType = "RSA PRIVATE KEY" + privateKeyPEMBlockType = "PRIVATE KEY" ) // protect an rsa key with a password @@ -36,9 +37,6 @@ func loadKeyFromFile(path string, password []byte) (*rsa.PrivateKey, error) { if pemBlock == nil { return nil, errors.New("PEM decode failed") } - if pemBlock.Type != rsaPrivateKeyPEMBlockType { - return nil, errors.New("unmatched type or headers") - } if string(password) != "" { b, err := x509.DecryptPEMBlock(pemBlock, password) diff --git a/certhelper/mdmcert_download.go b/certhelper/mdmcert_download.go index 2d0d48e..7665bdf 100644 --- a/certhelper/mdmcert_download.go +++ b/certhelper/mdmcert_download.go @@ -103,7 +103,7 @@ func decodeSignedRequest(p7Path, certPath, privPath, privPass string) error { return errors.New("PEM decode failed") } if pemBlock.Type != "CERTIFICATE" { - return errors.New("unmatched type or headers") + return errors.New("certificate: unmatched type or headers") } cert, err := x509.ParseCertificate(pemBlock.Bytes) if err != nil {