PKCS12_NEW(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– PKCS12_NEW(3) β€” bestie's guide to PKCS#12 personal information exchange (PFX) πŸ’–

okay so this one lives in the libcrypto library, and it's all about PFX β€” the personal information exchange vibe. let's get into it ✨


🌸 SYNOPSIS 🌸

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

like, four functions, two objects, no cap 🫢


πŸŽ€ DESCRIPTION πŸŽ€

So PKCS12_new() allocates and initializes an empty PKCS12 object β€” and this thing represents an ASN.1 PFX (personal information exchange) structure, which is defined in RFC 7292 section 4, iykyk. It can hold a pointer to a PKCS7 object (that's the one described over in PKCS7_new(3)) and optionally an instance of PKCS12_MAC_DATA, which we're literally about to talk about below. And PKCS12_free()? That frees pfx. clean and simple πŸ’…

Then there's PKCS12_MAC_DATA_new(), which allocates and initializes an empty PKCS12_MAC_DATA object. That one represents an ASN.1 MacData structure, also defined in RFC 7292 section 4. It's used inside PKCS12, and it can hold a pointer to an X509_SIG object (described in X509_SIG_new(3)) together with a salt value and an iteration count. iconique. and PKCS12_MAC_DATA_free() frees mac_data.

fr fr: _new() gives you the object, _free() takes it away. the way that's the whole cycle 😭

⭐ 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. so, like, always check for NULL, bestie πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, they're all part of the same friend group πŸ’œ


🌈 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. vintage πŸ’€βœ¨


and that's the page, periodt πŸŽ€ this Debian build is dated June 8, 2025 β€” mwah, enjoy your PFX objects bestie πŸ“πŸ§šπŸ’–

πŸ“¦ where this page comes from