cloudflare / cfssl

CFSSL: Cloudflare's PKI and TLS toolkit
https://cfssl.org/
BSD 2-Clause "Simplified" License
8.56k stars 1.09k forks source link

replace frozen crypto/pkcs12 library with software.sslmate.com/src/go-pkcs12 #1375

Open Hermsi1337 opened 2 months ago

Hermsi1337 commented 2 months ago

While playing around with cfssl a bit, I've noticed that its not always possible to decode .p12- or .pfx-files due to the following error:

unknown digest algorithm 2.16.840.1.101.3.4.2.1

While doing some research on this, I've found out, that the standard crypto/pkcs12-pkg is currently in a somewhat frozen state:
https://github.com/golang/go/issues/62375

This PR suggests replacing the (currently) frozen crypto/pkcs12 with the drop-in-replacement https://github.com/SSLMate/go-pkcs12.

I also had to rework the caCertificate-Handling a bit by using DecodeChain instead of Decode, since its possible that the provided pfxData may also include the ca-certificate chain which would lead to an error when passed to a simple Decode.

Let me know what you think.

Thanks!