PKCS12_SAFEBAG_NEW(3)

NAME
PKCS12_SAFEBAG_new, PKCS12_SAFEBAG_free, PKCS12_BAGS_new, PKCS12_BAGS_free - PKCS#12 container for one piece of information

SYNOPSIS
libcrypto
#include <openssl/pkcs12.h>
PKCS12_SAFEBAG *
PKCS12_SAFEBAG_new(void);
void
PKCS12_SAFEBAG_free(PKCS12_SAFEBAG *safebag);
PKCS12_BAGS *
PKCS12_BAGS_new(void);
void
PKCS12_BAGS_free(PKCS12_BAGS *bag);

DESCRIPTION
PKCS12_SAFEBAG_new() allocates and initializes an empty PKCS12_SAFEBAG object, representing an ASN.1 SafeBag structure defined in RFC 7292 section 4.2. It can hold a pointer to a PKCS12_BAGS object together with a type identifier and optional attributes. PKCS12_SAFEBAG_free() frees safebag.

PKCS12_BAGS_new() allocates and initializes an empty PKCS12_BAGS object, representing the bagValue field of an ASN.1 SafeBag structure. It is used in PKCS12_SAFEBAG and can hold a DER-encoded X.509 certificate, a base64-encoded SDSI certificate, a DER-encoded X.509 CRL, or other user-defined information.

If an instance of PKCS12_SAFEBAG contains PKCS8_PRIV_KEY_INFO, X509_SIG, or nested PKCS12_SAFEBAG objects, the respective pointers are stored directly in the PKCS12_SAFEBAG object rather than in the contained PKCS12_BAGS object as required by RFC 7292.

RETURN VALUES
PKCS12_SAFEBAG_new() and PKCS12_BAGS_new() return the new PKCS12_SAFEBAG or PKCS12_BAGS object, respectively, or NULL if an error occurs.

SEE ALSO
PKCS12_create(3), PKCS12_new(3), PKCS8_PRIV_KEY_INFO_new(3), X509_ATTRIBUTE_new(3), X509_CRL_new(3), X509_new(3), X509_SIG_new(3)

STANDARDS
RFC 7292: PKCS #12: Personal Information Exchange Syntax, section 4.2: The SafeBag Type

HISTORY
PKCS12_SAFEBAG_new(), PKCS12_SAFEBAG_free(), PKCS12_BAGS_new(), and PKCS12_BAGS_free() first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6.