1PKCS12_ADD_SAFE(3ossl)              OpenSSL             PKCS12_ADD_SAFE(3ossl)
2
3
4

NAME

6       PKCS12_add_safe, PKCS12_add_safe_ex, PKCS12_add_safes,
7       PKCS12_add_safes_ex - Create and add objects to a PKCS#12 structure
8

SYNOPSIS

10        #include <openssl/pkcs12.h>
11
12        int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
13                           int safe_nid, int iter, const char *pass);
14        int PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
15                               int safe_nid, int iter, const char *pass,
16                               OSSL_LIB_CTX *ctx, const char *propq);
17
18        PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
19        PKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid,
20                                    OSSL_LIB_CTX *ctx, const char *propq);
21

DESCRIPTION

23       PKCS12_add_safe() creates a new PKCS7 contentInfo containing the
24       supplied PKCS12_SAFEBAGs and adds this to a set of PKCS7 contentInfos.
25       Its type depends on the value of safe_nid:
26
27       •   If safe_nid is -1, a plain PKCS7 data contentInfo is created.
28
29       •   If safe_nid is a valid PBE algorithm NID, a PKCS7 encryptedData
30           contentInfo is created. The algorithm uses pass as the passphrase
31           and iter as the iteration count. If iter is zero then a default
32           value for iteration count of 2048 is used.
33
34       •   If safe_nid is 0, a PKCS7 encryptedData contentInfo is created
35           using a default encryption algorithm, currently
36           NID_pbe_WithSHA1And3_Key_TripleDES_CBC.
37
38       PKCS12_add_safe_ex() is identical to PKCS12_add_safe() but allows for a
39       library context ctx and property query propq to be used to select
40       algorithm implementations.
41
42       PKCS12_add_safes() creates a PKCS12 structure containing the supplied
43       set of PKCS7 contentInfos. The safes are enclosed first within a PKCS7
44       contentInfo of type p7_nid. Currently the only supported type is
45       NID_pkcs7_data.
46
47       PKCS12_add_safes_ex() is identical to PKCS12_add_safes() but allows for
48       a library context ctx and property query propq to be used to select
49       algorithm implementations.
50

NOTES

52       PKCS12_add_safe() makes assumptions regarding the encoding of the given
53       pass phrase.  See passphrase-encoding(7) for more information.
54

RETURN VALUES

56       PKCS12_add_safe() returns a value of 1 indicating success or 0 for
57       failure.
58
59       PKCS12_add_safes() returns a valid PKCS12 structure or NULL if an error
60       occurred.
61

CONFORMING TO

63       IETF RFC 7292 (<https://tools.ietf.org/html/rfc7292>)
64

SEE ALSO

66       PKCS12_create(3)
67

HISTORY

69       PKCS12_add_safe_ex() and PKCS12_add_safes_ex() were added in OpenSSL
70       3.0.
71
73       Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
74
75       Licensed under the Apache License 2.0 (the "License").  You may not use
76       this file except in compliance with the License.  You can obtain a copy
77       in the file LICENSE in the source distribution or at
78       <https://www.openssl.org/source/license.html>.
79
80
81
823.0.9                             2023-07-27            PKCS12_ADD_SAFE(3ossl)
Impressum