1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos PKCS12_add_safe, PKCS12_add_safe_ex, 6 1.1 christos PKCS12_add_safes, PKCS12_add_safes_ex - Create and add objects to a PKCS#12 structure 7 1.1 christos 8 1.1 christos =head1 SYNOPSIS 9 1.1 christos 10 1.1 christos #include <openssl/pkcs12.h> 11 1.1 christos 12 1.1 christos int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, 13 1.1 christos int safe_nid, int iter, const char *pass); 14 1.1 christos int PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, 15 1.1 christos int safe_nid, int iter, const char *pass, 16 1.1 christos OSSL_LIB_CTX *ctx, const char *propq); 17 1.1 christos 18 1.1 christos PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); 19 1.1 christos PKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid, 20 1.1 christos OSSL_LIB_CTX *ctx, const char *propq); 21 1.1 christos 22 1.1 christos =head1 DESCRIPTION 23 1.1 christos 24 1.1 christos PKCS12_add_safe() creates a new PKCS7 contentInfo containing the supplied 25 1.1 christos B<PKCS12_SAFEBAG>s and adds this to a set of PKCS7 contentInfos. Its type 26 1.1 christos depends on the value of B<safe_nid>: 27 1.1 christos 28 1.1 christos =over 4 29 1.1 christos 30 1.1 christos =item * If I<safe_nid> is -1, a plain PKCS7 I<data> contentInfo is created. 31 1.1 christos 32 1.1 christos =item * If I<safe_nid> is a valid PBE algorithm NID, a PKCS7 B<encryptedData> 33 1.1 christos contentInfo is created. The algorithm uses I<pass> as the passphrase and I<iter> 34 1.1 christos as the iteration count. If I<iter> is zero then a default value for iteration 35 1.1 christos count of 2048 is used. 36 1.1 christos 37 1.1 christos =item * If I<safe_nid> is 0, a PKCS7 B<encryptedData> contentInfo is created using 38 1.1 christos a default encryption algorithm, currently B<NID_pbe_WithSHA1And3_Key_TripleDES_CBC>. 39 1.1 christos 40 1.1 christos =back 41 1.1 christos 42 1.1 christos PKCS12_add_safe_ex() is identical to PKCS12_add_safe() but allows for a library 43 1.1 christos context I<ctx> and property query I<propq> to be used to select algorithm 44 1.1 christos implementations. 45 1.1 christos 46 1.1 christos PKCS12_add_safes() creates a B<PKCS12> structure containing the supplied set of 47 1.1 christos PKCS7 contentInfos. The I<safes> are enclosed first within a PKCS7 contentInfo 48 1.1 christos of type I<p7_nid>. Currently the only supported type is B<NID_pkcs7_data>. 49 1.1 christos 50 1.1 christos PKCS12_add_safes_ex() is identical to PKCS12_add_safes() but allows for a 51 1.1 christos library context I<ctx> and property query I<propq> to be used to select 52 1.1 christos algorithm implementations. 53 1.1 christos 54 1.1 christos =head1 NOTES 55 1.1 christos 56 1.1 christos PKCS12_add_safe() makes assumptions regarding the encoding of the given pass 57 1.1 christos phrase. 58 1.1 christos See L<passphrase-encoding(7)> for more information. 59 1.1 christos 60 1.1 christos =head1 RETURN VALUES 61 1.1 christos 62 1.1 christos PKCS12_add_safe() returns a value of 1 indicating success or 0 for failure. 63 1.1 christos 64 1.1 christos PKCS12_add_safes() returns a valid B<PKCS12> structure or NULL if an error occurred. 65 1.1 christos 66 1.1 christos =head1 CONFORMING TO 67 1.1 christos 68 1.1 christos IETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>) 69 1.1 christos 70 1.1 christos =head1 SEE ALSO 71 1.1 christos 72 1.1 christos L<PKCS12_create(3)> 73 1.1 christos 74 1.1 christos =head1 HISTORY 75 1.1 christos 76 1.1 christos PKCS12_add_safe_ex() and PKCS12_add_safes_ex() were added in OpenSSL 3.0. 77 1.1 christos 78 1.1 christos =head1 COPYRIGHT 79 1.1 christos 80 1.1 christos Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 81 1.1 christos 82 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 83 1.1 christos this file except in compliance with the License. You can obtain a copy 84 1.1 christos in the file LICENSE in the source distribution or at 85 1.1 christos L<https://www.openssl.org/source/license.html>. 86 1.1 christos 87 1.1 christos =cut 88