PKCS12_NEW(3)
π 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()andPKCS12_MAC_DATA_new()return the newPKCS12orPKCS12_MAC_DATAobject, respectively β orNULLif an error occurs. so, like, always check forNULL, bestie π
π¦ 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)
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
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms