Add documentation for CMS_EnvelopedData_create()
[openssl.git] / doc / man3 / CMS_EnvelopedData_create.pod
1 =pod
2
3 =head1 NAME
4
5 CMS_EnvelopedData_create - Create CMS envelope
6
7 =head1 SYNOPSIS
8
9  #include <openssl/cms.h>
10
11  CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
12
13 =head1 DESCRIPTION
14
15 CMS_EnvelopedData_create() creates a B<CMS_ContentInfo> structure with
16 a type B<NID_pkcs7_enveloped>. B<cipher> is the symmetric cipher to use.
17
18 The algorithm passed in the B<cipher> parameter must support ASN1 encoding of
19 its parameters.
20
21 The recipients can be added later using L<CMS_add1_recipient_cert(3)> or
22 L<CMS_add0_recipient_key(3)>.
23
24 The B<CMS_ContentInfo> structure needs to be finalized using L<CMS_final(3)>
25 and then freed using L<CMS_ContentInfo_free(3)>.
26
27 =head1 NOTES
28
29 Although CMS_EnvelopedData_create() allocates a new B<CMS_ContentInfo>
30 structure it is usually not used in applications. The wrappers
31 L<CMS_encrypt(3)> and L<CMS_decrypt(3)> are often used instead.
32
33 =head1 RETURN VALUES
34
35 If the allocation fails, CMS_EnvelopedData_create() returns NULL and sets
36 an error code that can be obtained by L<ERR_get_error(3)>.
37 Otherwise it returns a pointer to the newly allocated structure.
38
39 =head1 SEE ALSO
40
41 L<ERR_get_error(3)>, L<CMS_encrypt(3)>, L<CMS_decrypt(3)>, L<CMS_final(3)>
42
43 =head1 COPYRIGHT
44
45 Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
46
47 Licensed under the Apache License 2.0 (the "License").  You may not use
48 this file except in compliance with the License.  You can obtain a copy
49 in the file LICENSE in the source distribution or at
50 L<https://www.openssl.org/source/license.html>.
51
52 =cut