libressl-PKCS12_SAFEBAG_new(3)

libressl-PKCS12_SAFEBAG_new3

Pkcs#12 container for one piece of information

Usage

Crypto Library (libcrypto, -lcrypto)

#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);

Overview

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.

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.

From libressl 4.4.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's mdoc source.