diff --git a/vendor/github.com/sideshow/apns2/certificate/certificate.go b/vendor/github.com/sideshow/apns2/certificate/certificate.go index e103db0..cfd78de 100644 --- a/vendor/github.com/sideshow/apns2/certificate/certificate.go +++ b/vendor/github.com/sideshow/apns2/certificate/certificate.go @@ -16,17 +16,17 @@ import ( // Possible errors when parsing a certificate. var ( - ErrFailedToDecryptKey = errors.New("failed to decrypt private key") - ErrFailedToParsePKCS1PrivateKey = errors.New("failed to parse PKCS1 private key") - ErrFailedToParseCertificate = errors.New("failed to parse certificate PEM data") - ErrNoPrivateKey = errors.New("no private key") - ErrNoCertificate = errors.New("no certificate") + ErrFailedToDecryptKey = errors.New("failed to decrypt private key") + ErrFailedToParsePrivateKey = errors.New("failed to parse private key") + ErrFailedToParseCertificate = errors.New("failed to parse certificate PEM data") + ErrNoPrivateKey = errors.New("no private key") + ErrNoCertificate = errors.New("no certificate") ) // FromP12File loads a PKCS#12 certificate from a local file and returns a // tls.Certificate. // -// Use "" as the password argument if the pem certificate is not password +// Use "" as the password argument if the PKCS#12 certificate is not password // protected. func FromP12File(filename string, password string) (tls.Certificate, error) { p12bytes, err := ioutil.ReadFile(filename) @@ -120,9 +120,14 @@ func unencryptPrivateKey(block *pem.Block, password string) (crypto.PrivateKey, } func parsePrivateKey(bytes []byte) (crypto.PrivateKey, error) { + var key crypto.PrivateKey key, err := x509.ParsePKCS1PrivateKey(bytes) - if err != nil { - return nil, ErrFailedToParsePKCS1PrivateKey + if err == nil { + return key, nil } - return key, nil + key, err = x509.ParsePKCS8PrivateKey(bytes) + if err == nil { + return key, nil + } + return nil, ErrFailedToParsePrivateKey } diff --git a/vendor/vendor.json b/vendor/vendor.json index 0803ed4..3a8a606 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -451,16 +451,16 @@ "versionExact": "v0.13" }, { - "checksumSHA1": "c3x81Xq+gIn5JBgs1eCTVeRwDDo=", + "checksumSHA1": "EHOwwdWPJGt1vNVeJxyRDRHBhl8=", "path": "github.com/sideshow/apns2/certificate", - "revision": "c23f4b07d9e47aa490ff76001001decc688243f8", - "revisionTime": "2017-01-05T14:10:18Z" + "revision": "c6554aff77e6e5580dec977c8c33cc238f329ab0", + "revisionTime": "2018-04-13T21:53:35Z" }, { "checksumSHA1": "9Lxz0w+q8pqp/Do/kNa8hLoQeY0=", "path": "github.com/sideshow/apns2/payload", - "revision": "c23f4b07d9e47aa490ff76001001decc688243f8", - "revisionTime": "2017-01-05T14:10:18Z" + "revision": "c6554aff77e6e5580dec977c8c33cc238f329ab0", + "revisionTime": "2018-04-13T21:53:35Z" }, { "checksumSHA1": "nkQ/1JoIY4jh8XlI8LClfFVux9U=",