PKCS12_PACK_P7ENCDATA(3ossl)
π PKCS12_pack_p7encdata π
okay bestie, welcome to the 3ossl girlies' corner of the manual β yes, this is the OpenSSL one, and yes, we're gonna make it make sense π«Ά
β¨ NAME β¨
PKCS12_pack_p7encdata, PKCS12_pack_p7encdata_ex β the duo that packs a whole set of PKCS#12 safeBags into a PKCS#7 encrypted data object. it's giving "put it in a box and lock the box" energy π₯
πΈ SYNOPSIS πΈ
#include <openssl/pkcs12.h>
PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
unsigned char *salt, int saltlen, int iter,
STACK_OF(PKCS12_SAFEBAG) *bags);
PKCS7 *PKCS12_pack_p7encdata_ex(int pbe_nid, const char *pass, int passlen,
unsigned char *salt, int saltlen, int iter,
STACK_OF(PKCS12_SAFEBAG) *bags,
OSSL_LIB_CTX *ctx, const char *propq);
π DESCRIPTION π
so PKCS12_pack_p7encdata() literally generates a PKCS#7 ContentInfo object of encrypted-data type, and it makes it out of the set of safeBags in bags. main character behaviour honestly π
the algorithm ID you hand over in pbe_nid can be a PKCS#12 password based encryption algorithm, a PKCS#5 password based encryption algorithm, or a cipher algorithm. plot twist: if you pass a cipher algorithm, then the PKCS#5 PBES2 algorithm gets used, with that cipher as a parameter. slay π¦
the password pass of length passlen, the salt salt of length saltlen, and the iteration count iter are all inputs into the encryption operation. every single one of them, no skips π
then there's PKCS12_pack_p7encdata_ex(), which operates similar to the above (same vibe, same job) but lowkey lets a library context ctx and a property query propq be used to select the algorithm implementation. fancy β¨
π RETURN VALUES π
you get a PKCS7 object if it worked β cute! β or NULL if an error occurred. that's it, that's the whole vibe check π
π CONFORMING TO π
IETF RFC 2315 (<https://tools.ietf.org/html/rfc2315>) β yes we cite our sources, we're not animals π
π¦ SEE ALSO π¦
PKCS12_pbe_crypt_ex(3) β go read that one next bestie, iykyk π
β HISTORY β
PKCS12_pack_p7encdata_ex() was added in OpenSSL 3.0. the _ex version is the newer sibling, we stan a glow-up π
π COPYRIGHT π
Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page, no cap π«Ά this was OpenSSL 3.5.6, dated 2026-04-07, filed under the PKCS12_PACK_P7ENCDATA(3ossl) manual β mwah, go encrypt something gorgeous πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms