xref: /freebsd-src/crypto/openssl/doc/man3/PKCS12_SAFEBAG_create_cert.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_cert, PKCS12_SAFEBAG_create_crl,
6*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_secret, PKCS12_SAFEBAG_create0_p8inf,
7*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create0_pkcs8, PKCS12_SAFEBAG_create_pkcs8_encrypt,
8*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_pkcs8_encrypt_ex - Create PKCS#12 safeBag objects
9*b077aed3SPierre Pronchery
10*b077aed3SPierre Pronchery=head1 SYNOPSIS
11*b077aed3SPierre Pronchery
12*b077aed3SPierre Pronchery #include <openssl/pkcs12.h>
13*b077aed3SPierre Pronchery
14*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);
15*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);
16*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype,
17*b077aed3SPierre Pronchery                                              const unsigned char* value,
18*b077aed3SPierre Pronchery                                              int len);
19*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);
20*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);
21*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
22*b077aed3SPierre Pronchery                                                     const char *pass,
23*b077aed3SPierre Pronchery                                                     int passlen,
24*b077aed3SPierre Pronchery                                                     unsigned char *salt,
25*b077aed3SPierre Pronchery                                                     int saltlen, int iter,
26*b077aed3SPierre Pronchery                                                     PKCS8_PRIV_KEY_INFO *p8inf);
27*b077aed3SPierre Pronchery PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid,
28*b077aed3SPierre Pronchery                                                        const char *pass,
29*b077aed3SPierre Pronchery                                                        int passlen,
30*b077aed3SPierre Pronchery                                                        unsigned char *salt,
31*b077aed3SPierre Pronchery                                                        int saltlen, int iter,
32*b077aed3SPierre Pronchery                                                        PKCS8_PRIV_KEY_INFO *p8inf,
33*b077aed3SPierre Pronchery                                                        OSSL_LIB_CTX *ctx,
34*b077aed3SPierre Pronchery                                                        const char *propq);
35*b077aed3SPierre Pronchery
36*b077aed3SPierre Pronchery=head1 DESCRIPTION
37*b077aed3SPierre Pronchery
38*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_cert() creates a new B<PKCS12_SAFEBAG> of type B<NID_certBag>
39*b077aed3SPierre Proncherycontaining the supplied certificate.
40*b077aed3SPierre Pronchery
41*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_crl() creates a new B<PKCS12_SAFEBAG> of type B<NID_crlBag>
42*b077aed3SPierre Proncherycontaining the supplied crl.
43*b077aed3SPierre Pronchery
44*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_secret() creates a new B<PKCS12_SAFEBAG> of type
45*b077aed3SPierre Proncherycorresponding to a PKCS#12 B<secretBag>. The B<secretBag> contents are tagged as
46*b077aed3SPierre ProncheryI<type> with an ASN1 value of type I<vtype> constructed using the bytes in
47*b077aed3SPierre ProncheryI<value> of length I<len>.
48*b077aed3SPierre Pronchery
49*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create0_p8inf() creates a new B<PKCS12_SAFEBAG> of type B<NID_keyBag>
50*b077aed3SPierre Proncherycontaining the supplied PKCS8 structure.
51*b077aed3SPierre Pronchery
52*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create0_pkcs8() creates a new B<PKCS12_SAFEBAG> of type
53*b077aed3SPierre ProncheryB<NID_pkcs8ShroudedKeyBag> containing the supplied PKCS8 structure.
54*b077aed3SPierre Pronchery
55*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_pkcs8_encrypt() creates a new B<PKCS12_SAFEBAG> of type
56*b077aed3SPierre ProncheryB<NID_pkcs8ShroudedKeyBag> by encrypting the supplied PKCS8 I<p8inf>.
57*b077aed3SPierre ProncheryIf I<pbe_nid> is 0, a default encryption algorithm is used. I<pass> is the
58*b077aed3SPierre Proncherypassphrase and I<iter> is the iteration count. If I<iter> is zero then a default
59*b077aed3SPierre Proncheryvalue of 2048 is used. If I<salt> is NULL then a salt is generated randomly.
60*b077aed3SPierre Pronchery
61*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_pkcs8_encrypt_ex() is identical to PKCS12_SAFEBAG_create_pkcs8_encrypt()
62*b077aed3SPierre Proncherybut allows for a library context I<ctx> and property query I<propq> to be used to select
63*b077aed3SPierre Proncheryalgorithm implementations.
64*b077aed3SPierre Pronchery
65*b077aed3SPierre Pronchery=head1 NOTES
66*b077aed3SPierre Pronchery
67*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_pkcs8_encrypt() makes assumptions regarding the encoding of the given pass
68*b077aed3SPierre Proncheryphrase.
69*b077aed3SPierre ProncherySee L<passphrase-encoding(7)> for more information.
70*b077aed3SPierre Pronchery
71*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_secret() was added in OpenSSL 3.0.
72*b077aed3SPierre Pronchery
73*b077aed3SPierre Pronchery=head1 RETURN VALUES
74*b077aed3SPierre Pronchery
75*b077aed3SPierre ProncheryAll of these functions return a valid B<PKCS12_SAFEBAG> structure or NULL if an error occurred.
76*b077aed3SPierre Pronchery
77*b077aed3SPierre Pronchery=head1 CONFORMING TO
78*b077aed3SPierre Pronchery
79*b077aed3SPierre ProncheryIETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>)
80*b077aed3SPierre Pronchery
81*b077aed3SPierre Pronchery=head1 SEE ALSO
82*b077aed3SPierre Pronchery
83*b077aed3SPierre ProncheryL<PKCS12_create(3)>,
84*b077aed3SPierre ProncheryL<PKCS12_add_safe(3)>,
85*b077aed3SPierre ProncheryL<PKCS12_add_safes(3)>
86*b077aed3SPierre Pronchery
87*b077aed3SPierre Pronchery=head1 HISTORY
88*b077aed3SPierre Pronchery
89*b077aed3SPierre ProncheryPKCS12_SAFEBAG_create_pkcs8_encrypt_ex() was added in OpenSSL 3.0.
90*b077aed3SPierre Pronchery
91*b077aed3SPierre Pronchery=head1 COPYRIGHT
92*b077aed3SPierre Pronchery
93*b077aed3SPierre ProncheryCopyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
94*b077aed3SPierre Pronchery
95*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
96*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
97*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
98*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
99*b077aed3SPierre Pronchery
100*b077aed3SPierre Pronchery=cut
101