RSA Security logo

RSA BSAFE Cert-C
API Reference

PKCS12_BAG Reference

Represents a safe bag used in a PKCS #12 file.

It is either a certificate bag, a CRL bag, a key bag, or a secret bag. Use the PKCS12_BAG structure with the C_ReadFromPKCS12() and C_WriteToPKCS12() functions.

Data Fields
type An int value that identifies the type of data structure in the content union. Cert-C supports the following types of PKCS #12 safe bags:

PKCS #12 Safe Bag Type Description
PKCS12_KEY_BAG_TYPE A bag that contains a key pair
PKCS12_CERT_BAG_TYPE A bag that contains a certificate
PKCS12_CRL_BAG_TYPE A bag that contains a CRL
PKCS12_SECRET_BAG_TYPE A bag that contains a secret

content A union that contains a PKCS #12 safe bag in the format specified by type.

PKCS #12 Safe Bag Type Description
keyContent A KEY_CONTENT structure that represents the contents of a key bag. It holds a private key and a certificate that contains the matching public key for that private key.
certContent A CERT_CONTENT structure that represents the contents of a certificate bag. It is a CERT_OBJ.
crlContent A CRL_CONTENT structure that represents the contents of a CRL bag. It is a CRL_OBJ.
secretContent A SECRET_CONTENT structure that represents the contents of a secret bag. It holds a secret-content type-identifier and a secret-content value.

friendlyName An ITEM structure that specifies the friendly name associated with the PKCS #12 safe bag in content. The value must be a DER-encoded BMPString that consists of 2-byte characters. C_DEREncodeString() can produce this type of string, if the appropriate options are set. The demonstration code routine RSA_FormatPKCS12Password shows how to change an ASCII string containing a single-character representation to a multibyte BMPString.

#include <pkcs12.h>

00175 typedef struct PKCS12_BAG {
00176   int type;
00177   union  {
00178     KEY_CONTENT    keyContent;
00179     CERT_CONTENT   certContent;
00180     CRL_CONTENT    crlContent;
00181     SECRET_CONTENT secretContent;
00182   } content;
00183   ITEM friendlyName;
00184 } PKCS12_BAG;

The documentation for this struct was generated from the following file:


RSA BSAFE® Cert-C 2.7 API Reference