|  |  |  | GNU TLS API Reference Manual |  | 
|---|---|---|---|---|
enum gnutls_pkcs12_bag_type_t; #define MAX_BAG_ELEMENTS struct bag_element; #define BAG_PKCS8_KEY #define BAG_PKCS8_ENCRYPTED_KEY #define BAG_CERTIFICATE #define BAG_CRL #define DATA_OID #define ENC_DATA_OID #define FRIENDLY_NAME_OID #define KEY_ID_OID typedef gnutls_pkcs12_t; typedef gnutls_pkcs12_bag_t; int gnutls_pkcs12_init (gnutls_pkcs12_t *pkcs12); void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12); int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12, const gnutls_datum_t *data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12, int indx, gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t *bag); void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag); enum schema_id;
typedef enum gnutls_pkcs12_bag_type_t
{
  GNUTLS_BAG_EMPTY = 0,
  GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1,
  GNUTLS_BAG_PKCS8_KEY,
  GNUTLS_BAG_CERTIFICATE,
  GNUTLS_BAG_CRL,
  GNUTLS_BAG_ENCRYPTED = 10,
  GNUTLS_BAG_UNKNOWN = 20
} gnutls_pkcs12_bag_type_t;
struct bag_element {
  gnutls_datum_t data;
  gnutls_pkcs12_bag_type_t type;
  gnutls_datum_t local_key_id;
  char *friendly_name;
};
int gnutls_pkcs12_init (gnutls_pkcs12_t *pkcs12);
This function will initialize a PKCS12 structure. PKCS12 structures usually contain lists of X.509 Certificates and X.509 Certificate revocation lists.
| pkcs12: | |
| Returns : | 
void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12);
This function will deinitialize a PKCS12 structure.
| pkcs12: | 
int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12, const gnutls_datum_t *data, gnutls_x509_crt_fmt_t format, unsigned int flags);
This function will convert the given DER or PEM encoded PKCS12 to the native gnutls_pkcs12_t format. The output will be stored in 'pkcs12'.
If the PKCS12 is PEM encoded it should have a header of "PKCS12".
| pkcs12: | |
| data: | |
| format: | |
| flags: | |
| Returns : | 
int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12, int indx, gnutls_pkcs12_bag_t bag);
This function will return a Bag from the PKCS12 structure.
| pkcs12: | |
| indx: | |
| bag: | |
| Returns : | 
int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t *bag);
This function will initialize a PKCS12 bag structure. PKCS12 Bags usually contain private keys, lists of X.509 Certificates and X.509 Certificate revocation lists.
| bag: | |
| Returns : | 
void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag);
This function will deinitialize a PKCS12 Bag structure.
| bag: |