---
name: "libressl-PKCS12_new"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-PKCS12_new"
---

# libressl-PKCS12\_new(3)

PKCS#12 personal information exchange (PFX)

## NAME

**PKCS12\_new**, **PKCS12\_free**, **PKCS12\_MAC\_DATA\_new**, **PKCS12\_MAC\_DATA\_free** – PKCS#12 personal information exchange (PFX)

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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.
