[gnutls-help] pkcs12 format not understood by GNUTLS 3.1.18
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Fri Jan 10 23:16:46 CET 2014
On 01/10/2014 02:32 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> There is an issue reported to me that GNUTLS 3.1.18 fails to load
> a certificate / public key, from a PKCS#12 file in DER format
> created by the following command:
>
> openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
>
> When the "certificate.pfx" file is then read with the following GNUTLS call,
> an error -60 gets returned:
>
> err = gnutls_certificate_set_x509_simple_pkcs12_file(cred, "certificate.pfx", GNUTLS_X509_FMT_DER, pass);
-60 is GNUTLS_E_CERTIFICATE_KEY_MISMATCH.
> Yet that works perfectly with an older GNUTLS version (e.g. 2.4.2).
yow, that is a much older version of GnuTLS. I'm unaware of anyone who
is supporting it right now.
> If CACert.crt is not included in the .pfx file, the code above begins
> to work with the current GNUTLS release (3.1.18).
>
> Is this the expected behavior?
in lib/gnutls_x509.c, in version 3.1.18, in the comments above
gnutls_certificate_set_x509_simple_pkcs12_file, it says:
* PKCS#12 file may contain many keys and/or certificates, and there
* is no way to identify which key/certificate pair you want. You
* should make sure the PKCS#12 file only contain one key/certificate
* pair and/or one CRL.
the same paragraph is present on the latest version, 3.2.8:
http://gnutls.org/manual/html_node/Core-TLS-API.html#index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile
so i'd say this is expected behavior -- based on the way the certs are
place into the bag emitted by openssl pkcs12, gnutls doesn't know which
cert to use when your .pfx file contains both the EE's cert and the CA's
cert.
I'm unsure why it loaded the complex .pfx file loads at all in 2.4.2.
perhaps 2.4.2 will offer the wrong certificate to the TLS peer it
communicates with if it loads the generated .pfx file?
--dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1027 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20140110/26722302/attachment-0001.sig>
More information about the Gnutls-help
mailing list