I have a generated base64 .p12 file to authenticate to a service and my resty client expects to receive a tls.Certificate.
However, pkcs12.Decode always fail with ": asn1: syntax error: indefinite length found (not DER)"
Does it mean that I need to convert my base64 encoded .p12 file into a der formatted file? Or what else am I supposed to do to send the certificate to the server?
data, _ := ioutil.ReadFile("/PathTo/certificate.p12")
privateKey, certificate, _ := pkcs12.Decode(data, "abc123")//password=abc123
tlsCertificate := tls.Certificate{
Certificate: [][]byte{cert.Raw},
PrivateKey: privateKey,
Leaf: cert,
}
//...
resty.SetCertificates(tlsCertificate)