1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | PKCS12_add_cert, PKCS12_add_key, PKCS12_add_key_ex,
|
---|
6 | PKCS12_add_secret - Add an object to a set of PKCS#12 safeBags
|
---|
7 |
|
---|
8 | =head1 SYNOPSIS
|
---|
9 |
|
---|
10 | #include <openssl/pkcs12.h>
|
---|
11 |
|
---|
12 | PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
|
---|
13 | PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,
|
---|
14 | EVP_PKEY *key, int key_usage, int iter,
|
---|
15 | int key_nid, const char *pass);
|
---|
16 | PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags,
|
---|
17 | EVP_PKEY *key, int key_usage, int iter,
|
---|
18 | int key_nid, const char *pass,
|
---|
19 | OSSL_LIB_CTX *ctx, const char *propq);
|
---|
20 |
|
---|
21 | PKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags,
|
---|
22 | int nid_type, const unsigned char *value, int len);
|
---|
23 |
|
---|
24 | =head1 DESCRIPTION
|
---|
25 |
|
---|
26 | These functions create a new B<PKCS12_SAFEBAG> and add it to the set of safeBags
|
---|
27 | in I<pbags>.
|
---|
28 |
|
---|
29 | PKCS12_add_cert() creates a PKCS#12 certBag containing the supplied
|
---|
30 | certificate and adds this to the set of PKCS#12 safeBags.
|
---|
31 |
|
---|
32 | PKCS12_add_key() creates a PKCS#12 keyBag (unencrypted) or a pkcs8shroudedKeyBag
|
---|
33 | (encrypted) containing the supplied B<EVP_PKEY> and adds this to the set of PKCS#12
|
---|
34 | safeBags. If I<key_nid> is not -1 then the key is encrypted with the supplied
|
---|
35 | algorithm, using I<pass> as the passphrase and I<iter> as the iteration count. If
|
---|
36 | I<iter> is zero then a default value for iteration count of 2048 is used.
|
---|
37 |
|
---|
38 | PKCS12_add_key_ex() is identical to PKCS12_add_key() but allows for a library
|
---|
39 | context I<ctx> and property query I<propq> to be used to select algorithm
|
---|
40 | implementations.
|
---|
41 |
|
---|
42 | PKCS12_add_secret() creates a PKCS#12 secretBag with an OID corresponding to
|
---|
43 | the supplied I<nid_type> containing the supplied value as an ASN1 octet string.
|
---|
44 | This is then added to the set of PKCS#12 safeBags.
|
---|
45 |
|
---|
46 | =head1 NOTES
|
---|
47 |
|
---|
48 | If a certificate contains an I<alias> or a I<keyid> then this will be
|
---|
49 | used for the corresponding B<friendlyName> or B<localKeyID> in the
|
---|
50 | PKCS12 structure.
|
---|
51 |
|
---|
52 | PKCS12_add_key() makes assumptions regarding the encoding of the given pass
|
---|
53 | phrase.
|
---|
54 | See L<passphrase-encoding(7)> for more information.
|
---|
55 |
|
---|
56 | =head1 RETURN VALUES
|
---|
57 |
|
---|
58 | A valid B<PKCS12_SAFEBAG> structure or NULL if an error occurred.
|
---|
59 |
|
---|
60 | =head1 CONFORMING TO
|
---|
61 |
|
---|
62 | IETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>)
|
---|
63 |
|
---|
64 | =head1 SEE ALSO
|
---|
65 |
|
---|
66 | L<PKCS12_create(3)>
|
---|
67 |
|
---|
68 | =head1 HISTORY
|
---|
69 |
|
---|
70 | PKCS12_add_secret() and PKCS12_add_key_ex() were added in OpenSSL 3.0.
|
---|
71 |
|
---|
72 | =head1 COPYRIGHT
|
---|
73 |
|
---|
74 | Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
|
---|
75 |
|
---|
76 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
77 | this file except in compliance with the License. You can obtain a copy
|
---|
78 | in the file LICENSE in the source distribution or at
|
---|
79 | L<https://www.openssl.org/source/license.html>.
|
---|
80 |
|
---|
81 | =cut
|
---|