What version of Go are you using (go version)?
go version devel +eced964 Tue Apr 14 17:19:36 2015 +0000 darwin/amd64
What operating system and processor architecture are you using?
darwin/amd64
What did you do?
I am using the Azure go-pkcs12 package to load a .p12 file exported from my Mac keychain. The PEM data from this library looks good and is without error, but X509KeyPair fails with:
x509: unhandled critical extension
package main
import (
"crypto/tls"
"encoding/pem"
"io/ioutil"
"log"
"github.com/Azure/go-pkcs12"
)
func main() {
p12, err := ioutil.ReadFile("Certificates.p12")
if err != nil {
log.Fatal(err)
}
blocks, err := pkcs12.ConvertToPEM(p12, "password")
if err != nil {
log.Fatal(err)
}
pemData := []byte{}
for _, b := range blocks {
pemData = append(pemData, pem.EncodeToMemory(b)...)
}
log.Println(string(pemData))
// then use PEM data for tls to construct tls certificate:
cert, err := tls.X509KeyPair(pemData, pemData)
if err != nil {
log.Fatal(err)
}
_ = cert
}
What did you expect to see?
A valid tls.X509KeyPair without error.
I would like to be able to load .p12 files directly to use with https://github.com/timehop/apns for push notifications. Currently I need to use OpenSSL (bindings) to do the conversion to a format Go understands.
What did you see instead?
x509: unhandled critical extension
This is failing because there are "Unknown extensions cause an error if marked as critical." (src)
In this case, the failing extension is 1.2.840.113635.100.6.1.2.0.0 APPLE_EXTENSION_ADC_APPLE_SIGNING which is flagged as critical.
What version of Go are you using (go version)?
go version devel +eced964 Tue Apr 14 17:19:36 2015 +0000 darwin/amd64
What operating system and processor architecture are you using?
darwin/amd64
What did you do?
I am using the Azure go-pkcs12 package to load a .p12 file exported from my Mac keychain. The PEM data from this library looks good and is without error, but X509KeyPair fails with:
What did you expect to see?
A valid tls.X509KeyPair without error.
I would like to be able to load .p12 files directly to use with https://github.com/timehop/apns for push notifications. Currently I need to use OpenSSL (bindings) to do the conversion to a format Go understands.What did you see instead?
x509: unhandled critical extension
This is failing because there are "Unknown extensions cause an error if marked as critical." (src)
In this case, the failing extension is
1.2.840.113635.100.6.1.2.0.0APPLE_EXTENSION_ADC_APPLE_SIGNING which is flagged as critical.