[gnutls-help] Reading non-standard bag attributes in a PKCS12 file

Nikos Mavrogiannopoulos nmav at gnutls.org
Thu Feb 25 09:43:42 CET 2016

On Wed, Feb 24, 2016 at 6:36 AM, John Marvin <jm-gnutls at themarvins.org> wrote:
> I'm trying to read bag attributes for the bag containing the private key in
> a PKCS12 file. There are some specific routines for reading the local Key ID
> and the friendly name, but I don't see any equivalent of
> gnutls_x509_crt_get_dn_oid() or other routines to read other attributes
> (non-standard attributes in this case).

There aren't any as far as I remember.

> Am I missing something, or am I just going to have to call
> gnutls_pkcs_bag_get_data() and start parsing the encoded data myself?

Correct. If you think that can be of value to others as well, and
there is something you could propose to improve this API in that
aspect (or better send a patch), please do.

However, my early impression of PKCS#12 was that this is a terrible
format for a file, and can be extended in any unexpected way, so I
kept the features limited to standard fields so that the API is kept
sane and simple.


More information about the Gnutls-help mailing list