Skip to content

x/crypto/pkcs12: SSL certificate decode validation error #14015

Closed
@tipycalFlow

Description

@tipycalFlow

This is in continuation with #13855

I'm trying to use the x/crypto/pkcs12 package's Decode method to read this p12 file (public-certificate + private-key pair) with password googler to further generate a TLS certificate but get the following error:
pkcs12: expected exactly two safe bags in the PFX PDU

Here's how I'm reading the certificate file: p12, err := ioutil.ReadFile("filename")
and I'm passing the read binary data to Decode(p12, "password")

I logged the number of safe bags returned from getSafeContents before line 219: if len(bags) != 2 { and it returned 4, which is why Decode is failing. Now I'm using go1.6beta1 darwin/amd64 on OS X Yosemite version 10.10.5 (14F1509) and I generate the certificate by exporting both certificate and private key to a .p12 as shown below:
screen

I suspect the validation at line 219: if len(bags) != 2 { might be either incomplete or maybe I'm missing something. I've attached the certificate in question here with password googler for testing...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions