PKCS12_ADD_SAFE(3ossl)
π PKCS12_ADD_SAFE π
okay bestie, so this is the 3ossl page for the PKCS#12 safe-bag squad β four functions that build PKCS#12 structures and shove objects into them. no cap, it's giving "assembly instructions for a very specific little box." let's go β¨
β¨ SYNOPSIS β¨
like, the actual receipts π§Ύ
#include <openssl/pkcs12.h>
int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
int safe_nid, int iter, const char *pass);
int PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
int safe_nid, int iter, const char *pass,
OSSL_LIB_CTX *ctx, const char *propq);
PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
PKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid,
OSSL_LIB_CTX *ctx, const char *propq);
π DESCRIPTION π
so PKCS12_add_safe() is the main character here π β it creates a brand-new PKCS7 contentInfo holding all the PKCS12_SAFEBAGs you handed it, then adds that to a whole set of PKCS7 contentInfos. and literally what kind of thing it becomes? that depends on safe_nid:
- π«Ά if
safe_nidis-1, you get a plain PKCS7 datacontentInfo. simple. clean. iconic. - π if
safe_nidis a valid PBE algorithm NID, you get a PKCS7 encryptedDatacontentInfo. it usespassas the passphrase anditeras the iteration count. and listen β ifiteris zero, it just quietly uses a default iteration count of2048. periodt. - πΈ if
safe_nidis0, you get a PKCS7 encryptedDatacontentInfotoo, but built with a default encryption algorithm β currentlyNID_pbe_WithSHA1And3_Key_TripleDES_CBC.
then PKCS12_add_safe_ex() β she's identical to PKCS12_add_safe(), no notes, but she lets you pass a library context ctx and a property query propq so the algorithm implementations get picked with those. iykyk π
PKCS12_add_safes() builds a PKCS12 structure containing the supplied set of PKCS7 contentInfos. the safes get tucked inside a PKCS7 contentInfo of type p7_nid first. and rn? the only supported type is NID_pkcs7_data. that's it. that's the list. π
PKCS12_add_safes_ex() β same energy as PKCS12_add_safes(), but again with ctx and propq for picking algorithm implementations. slay β¨
π¦ NOTES π¦
heads up bestie, PKCS12_add_safe() makes assumptions about how your pass phrase is encoded π. like, it's not out here asking questions. see passphrase-encoding(7) for the whole story.
β RETURN VALUES β
PKCS12_add_safe()β returns1for success,0for failure. that's the whole vibe check.PKCS12_add_safes()β returns a validPKCS12structure, orNULLif something went wrong π.
π CONFORMING TO π
IETF RFC 7292 β and yeah, the source lists it as https://tools.ietf.org/html/rfc7292 π§
π₯ SEE ALSO π₯
PKCS12_create(3) β go read that one too, bestie π«Ά
π HISTORY π
PKCS12_add_safe_ex() and PKCS12_add_safes_ex() are the new girls β they were added in OpenSSL 3.0. π
π COPYRIGHT π
Copyright 2020-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.
fr fr, read the license before you copy the file. it's not optional, bestie. β οΈ
okay that's the whole page!! mwah π this was OpenSSL 3.5.6, dated 2026-04-07, and the manual name is PKCS12_ADD_SAFE(3ossl) β catch you on the next one, love u, bye!! ππ¦β¨
π¦ 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