Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
update PEM errors
Browse files Browse the repository at this point in the history
  • Loading branch information
groob committed Dec 4, 2017
1 parent a53d3e9 commit 04dd8ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions certhelper/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

const (
rsaPrivateKeyPEMBlockType = "RSA PRIVATE KEY"
privateKeyPEMBlockType = "PRIVATE KEY"
)

// protect an rsa key with a password
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion certhelper/mdmcert_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 04dd8ae

Please sign in to comment.