Add X509_NAME_hash_ex() to be able to check if it failed due to unsupported SHA1
[openssl.git] / doc / man3 / PKCS12_add_safe.pod
1 =pod
2
3 =head1 NAME
4
5 PKCS12_add_safe, PKCS12_add_safes - Create and add objects to a PKCS#12 structure
6
7 =head1 SYNOPSIS
8
9  #include <openssl/pkcs12.h>
10
11  int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
12                     int safe_nid, int iter, const char *pass);
13  PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
14
15 =head1 DESCRIPTION
16
17 PKCS12_add_safe() creates a new PKCS7 contentInfo containing the supplied
18 B<PKCS12_SAFEBAG>s and adds this to a set of PKCS7 contentInfos. Its type
19 depends on the value of B<safe_nid>:
20
21 =over 4
22
23 =item * If I<safe_nid> is -1, a plain PKCS7 I<data> contentInfo is created.
24
25 =item * If I<safe_nid> is a valid PBE algorithm NID, a PKCS7 B<encryptedData>
26 contentInfo is created. The algorithm uses I<pass> as the passphrase and I<iter>
27 as the iteration count. If I<iter> is zero then a default value for iteration
28 count of 2048 is used.
29
30 =item * If I<safe_nid> is 0, a PKCS7 B<encryptedData> contentInfo is created using
31 a default encryption algorithm, currently B<NID_pbe_WithSHA1And3_Key_TripleDES_CBC>.
32
33 =back
34
35 PKCS12_add_safes() creates a B<PKCS12> structure containing the supplied set of
36 PKCS7 contentInfos. The I<safes> are enclosed first within a PKCS7 contentInfo
37 of type I<p7_nid>. Currently the only supported type is B<NID_pkcs7_data>.
38
39 =head1 NOTES
40
41 PKCS12_add_safe() makes assumptions regarding the encoding of the given pass
42 phrase.
43 See L<passphrase-encoding(7)> for more information.
44
45 =head1 RETURN VALUES
46
47 PKCS12_add_safe() returns a value of 1 indicating success or 0 for failure.
48
49 PKCS12_add_safes() returns a valid B<PKCS12> structure or NULL if an error occurred.
50
51 =head1 SEE ALSO
52
53 L<PKCS12_create(3)>
54
55 =head1 COPYRIGHT
56
57 Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
58
59 Licensed under the Apache License 2.0 (the "License").  You may not use
60 this file except in compliance with the License.  You can obtain a copy
61 in the file LICENSE in the source distribution or at
62 L<https://www.openssl.org/source/license.html>.
63
64 =cut