]>
Commit | Line | Data |
---|---|---|
2b5e12f5 JZ |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
d8652be0 MC |
5 | CMS_EnvelopedData_create_ex, CMS_EnvelopedData_create, |
6 | CMS_AuthEnvelopedData_create, CMS_AuthEnvelopedData_create_ex | |
c1669f41 | 7 | - Create CMS envelope |
2b5e12f5 JZ |
8 | |
9 | =head1 SYNOPSIS | |
10 | ||
11 | #include <openssl/cms.h> | |
12 | ||
924663c3 | 13 | CMS_ContentInfo * |
b4250010 | 14 | CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx, |
d8652be0 | 15 | const char *propq); |
2b5e12f5 JZ |
16 | CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); |
17 | ||
924663c3 | 18 | CMS_ContentInfo * |
b4250010 | 19 | CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx, |
d8652be0 | 20 | const char *propq); |
924663c3 JZ |
21 | CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher); |
22 | ||
2b5e12f5 JZ |
23 | =head1 DESCRIPTION |
24 | ||
d8652be0 | 25 | CMS_EnvelopedData_create_ex() creates a B<CMS_ContentInfo> structure |
924663c3 JZ |
26 | with a type B<NID_pkcs7_enveloped>. I<cipher> is the symmetric cipher to use. |
27 | The library context I<libctx> and the property query I<propq> are used when | |
c1669f41 | 28 | retrieving algorithms from providers. |
2b5e12f5 | 29 | |
d8652be0 | 30 | CMS_AuthEnvelopedData_create_ex() creates a B<CMS_ContentInfo> |
924663c3 JZ |
31 | structure with a type B<NID_id_smime_ct_authEnvelopedData>. B<cipher> is the |
32 | symmetric AEAD cipher to use. Currently only AES variants with GCM mode are | |
33 | supported. The library context I<libctx> and the property query I<propq> are | |
34 | used when retrieving algorithms from providers. | |
35 | ||
c1669f41 | 36 | The algorithm passed in the I<cipher> parameter must support ASN1 encoding of |
2b5e12f5 JZ |
37 | its parameters. |
38 | ||
39 | The recipients can be added later using L<CMS_add1_recipient_cert(3)> or | |
40 | L<CMS_add0_recipient_key(3)>. | |
41 | ||
42 | The B<CMS_ContentInfo> structure needs to be finalized using L<CMS_final(3)> | |
43 | and then freed using L<CMS_ContentInfo_free(3)>. | |
44 | ||
924663c3 | 45 | CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create are similar to |
d8652be0 MC |
46 | CMS_EnvelopedData_create_ex() and |
47 | CMS_AuthEnvelopedData_create_ex() but use default values of NULL for | |
924663c3 | 48 | the library context I<libctx> and the property query I<propq>. |
c1669f41 | 49 | |
2b5e12f5 JZ |
50 | =head1 NOTES |
51 | ||
924663c3 JZ |
52 | Although CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() allocate |
53 | a new B<CMS_ContentInfo> structure, they are not usually used in applications. | |
54 | The wrappers L<CMS_encrypt(3)> and L<CMS_decrypt(3)> are often used instead. | |
2b5e12f5 JZ |
55 | |
56 | =head1 RETURN VALUES | |
57 | ||
924663c3 JZ |
58 | If the allocation fails, CMS_EnvelopedData_create() and |
59 | CMS_AuthEnvelopedData_create() return NULL and set an error code that can be | |
60 | obtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly | |
61 | allocated structure. | |
2b5e12f5 JZ |
62 | |
63 | =head1 SEE ALSO | |
64 | ||
65 | L<ERR_get_error(3)>, L<CMS_encrypt(3)>, L<CMS_decrypt(3)>, L<CMS_final(3)> | |
66 | ||
c8511e89 | 67 | =head1 HISTORY |
c1669f41 | 68 | |
d8652be0 | 69 | The CMS_EnvelopedData_create_ex() method was added in OpenSSL 3.0. |
c1669f41 | 70 | |
2b5e12f5 JZ |
71 | =head1 COPYRIGHT |
72 | ||
8020d79b | 73 | Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. |
2b5e12f5 JZ |
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 | L<https://www.openssl.org/source/license.html>. | |
79 | ||
80 | =cut |