PKCS12_NEW(3) | Library Functions Manual | PKCS12_NEW(3)

# NAME

`PKCS12_new`, `PKCS12_free`, `PKCS12_MAC_DATA_new`, `PKCS12_MAC_DATA_free` — PKCS#12 personal information exchange (PFX)

# SYNOPSIS

library “libcrypto”
`#include <openssl/pkcs12.h>`

PKCS12 *
`PKCS12_new`(void);

void
`PKCS12_free`(PKCS12 *pfx);

PKCS12_MAC_DATA *
`PKCS12_MAC_DATA_new`(void);

void
`PKCS12_MAC_DATA_free`(PKCS12_MAC_DATA *mac_data);

# DESCRIPTION

`PKCS12_new`() allocates and initializes an empty PKCS12 object, representing an ASN.1 PFX (personal information exchange) structure defined in RFC 7292 section 4. It can hold a pointer to a PKCS7 object described in PKCS7_new(3) and optionally an instance of PKCS12_MAC_DATA described below. `PKCS12_free`() frees pfx.

`PKCS12_MAC_DATA_new`() allocates and initializes an empty PKCS12_MAC_DATA object, representing an ASN.1 MacData structure defined in RFC 7292 section 4. It is used inside PKCS12 and can hold a pointer to an X509_SIG object described in X509_SIG_new(3) together with a salt value and an iteration count. `PKCS12_MAC_DATA_free`() frees mac_data.

# RETURN VALUES

`PKCS12_new`() and `PKCS12_MAC_DATA_new`() return the new PKCS12 or PKCS12_MAC_DATA object, respectively, or `NULL` if an error occurs.

# SEE ALSO

d2i_PKCS12(3), PKCS12_create(3), PKCS12_newpass(3), PKCS12_parse(3), PKCS12_SAFEBAG_new(3), PKCS7_new(3), X509_SIG_new(3)

# STANDARDS

RFC 7292: PKCS #12: Personal Information Exchange Syntax

# HISTORY

`PKCS12_new`(), `PKCS12_free`(), `PKCS12_MAC_DATA_new`(), and `PKCS12_MAC_DATA_free`() first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6.

June 8, 2025 | Debian