PKCS12_SAFEBAG_CREATE_CERT(3ossl)
π PKCS12_SAFEBAG_CREATE_CERT(3ossl) π
okay bestie, welcome to the (3ossl) manual for the OpenSSL safeBag-building squad. We're making PKCS#12 safeBag objects and it is main character era. No cap. π
β¨ NAME β¨
Meet the whole glow-up crew: PKCS12_SAFEBAG_create_cert, PKCS12_SAFEBAG_create_crl, PKCS12_SAFEBAG_create_secret, PKCS12_SAFEBAG_create0_p8inf, PKCS12_SAFEBAG_create0_pkcs8, PKCS12_SAFEBAG_create_pkcs8_encrypt, and PKCS12_SAFEBAG_create_pkcs8_encrypt_ex. They create PKCS#12 safeBag objects. π«Ά
π SYNOPSIS π
bestie, grab the include and the exact signatures:
#include <openssl/pkcs12.h>
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype,
const unsigned char* value,
int len);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
const char *pass,
int passlen,
unsigned char *salt,
int saltlen, int iter,
PKCS8_PRIV_KEY_INFO *p8inf);
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid,
const char *pass,
int passlen,
unsigned char *salt,
int saltlen, int iter,
PKCS8_PRIV_KEY_INFO *p8inf,
OSSL_LIB_CTX *ctx,
const char *propq);
π DESCRIPTION π
PKCS12_SAFEBAG_create_cert()β creates a newPKCS12_SAFEBAGof typeNID_certBagcontaining the supplied certificate. Iconic cert-bag behavior. πΈPKCS12_SAFEBAG_create_crl()β creates a newPKCS12_SAFEBAGof typeNID_crlBagcontaining the suppliedcrl. πPKCS12_SAFEBAG_create_secret()β creates a newPKCS12_SAFEBAGof type corresponding to a PKCS#12 secretBag. The secretBag contents are tagged astypewith an ASN1 value of typevtypeconstructed using the bytes invalueof lengthlen. Secret-bag realness. πPKCS12_SAFEBAG_create0_p8inf()β creates a newPKCS12_SAFEBAGof typeNID_keyBagcontaining the supplied PKCS8 structure. πPKCS12_SAFEBAG_create0_pkcs8()β creates a newPKCS12_SAFEBAGof typeNID_pkcs8ShroudedKeyBagcontaining the supplied PKCS8 structure. Shrouded, but make it fashion. π¦PKCS12_SAFEBAG_create_pkcs8_encrypt()β creates a newPKCS12_SAFEBAGof typeNID_pkcs8ShroudedKeyBagby encrypting the supplied PKCS8p8inf. Ifpbe_nidis0, a default encryption algorithm is used.passis the passphrase anditeris the iteration count. Ifiteris zero then a default value of2048is used. IfsaltisNULLthen a salt is generated randomly. Literally the encryption moment. π₯PKCS12_SAFEBAG_create_pkcs8_encrypt_ex()β is identical toPKCS12_SAFEBAG_create_pkcs8_encrypt()but allows for a library contextctxand property querypropqto be used to select algorithm implementations. Fancy algorithm-picking energy. β¨
π§ NOTES π§
PKCS12_SAFEBAG_create_pkcs8_encrypt()makes assumptions regarding the encoding of the given pass phrase. Seepassphrase-encoding(7)for more information. ngl, passphrase encoding is a whole vibe. πPKCS12_SAFEBAG_create_secret()was added in OpenSSL3.0. π
π¦ RETURN VALUES π¦
All of these functions return a valid PKCS12_SAFEBAG structure or NULL if an error occurred. That's the whole mood. π
π CONFORMING TO π
IETF RFC 7292 (<https://tools.ietf.org/html/rfc7292>) β standards behavior, periodt. π
π SEE ALSO π
π°οΈ HISTORY π°οΈ
PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() was added in OpenSSL 3.0. β¨
π COPYRIGHT π
Copyright 2019-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>.
β signed off with π by OpenSSL 3.5.6, dated 2026-04-07, for PKCS12_SAFEBAG_CREATE_CERT(3ossl) π«Ά
π¦ 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