1*b077aed3SPierre Pronchery=pod 2*b077aed3SPierre Pronchery 3*b077aed3SPierre Pronchery=head1 NAME 4*b077aed3SPierre Pronchery 5*b077aed3SPierre ProncheryCMS_EnvelopedData_create_ex, CMS_EnvelopedData_create, 6*b077aed3SPierre ProncheryCMS_AuthEnvelopedData_create, CMS_AuthEnvelopedData_create_ex 7*b077aed3SPierre Pronchery- Create CMS envelope 8*b077aed3SPierre Pronchery 9*b077aed3SPierre Pronchery=head1 SYNOPSIS 10*b077aed3SPierre Pronchery 11*b077aed3SPierre Pronchery #include <openssl/cms.h> 12*b077aed3SPierre Pronchery 13*b077aed3SPierre Pronchery CMS_ContentInfo * 14*b077aed3SPierre Pronchery CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx, 15*b077aed3SPierre Pronchery const char *propq); 16*b077aed3SPierre Pronchery CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); 17*b077aed3SPierre Pronchery 18*b077aed3SPierre Pronchery CMS_ContentInfo * 19*b077aed3SPierre Pronchery CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx, 20*b077aed3SPierre Pronchery const char *propq); 21*b077aed3SPierre Pronchery CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher); 22*b077aed3SPierre Pronchery 23*b077aed3SPierre Pronchery=head1 DESCRIPTION 24*b077aed3SPierre Pronchery 25*b077aed3SPierre ProncheryCMS_EnvelopedData_create_ex() creates a B<CMS_ContentInfo> structure 26*b077aed3SPierre Proncherywith a type B<NID_pkcs7_enveloped>. I<cipher> is the symmetric cipher to use. 27*b077aed3SPierre ProncheryThe library context I<libctx> and the property query I<propq> are used when 28*b077aed3SPierre Proncheryretrieving algorithms from providers. 29*b077aed3SPierre Pronchery 30*b077aed3SPierre ProncheryCMS_AuthEnvelopedData_create_ex() creates a B<CMS_ContentInfo> 31*b077aed3SPierre Proncherystructure with a type B<NID_id_smime_ct_authEnvelopedData>. B<cipher> is the 32*b077aed3SPierre Proncherysymmetric AEAD cipher to use. Currently only AES variants with GCM mode are 33*b077aed3SPierre Proncherysupported. The library context I<libctx> and the property query I<propq> are 34*b077aed3SPierre Proncheryused when retrieving algorithms from providers. 35*b077aed3SPierre Pronchery 36*b077aed3SPierre ProncheryThe algorithm passed in the I<cipher> parameter must support ASN1 encoding of 37*b077aed3SPierre Proncheryits parameters. 38*b077aed3SPierre Pronchery 39*b077aed3SPierre ProncheryThe recipients can be added later using L<CMS_add1_recipient_cert(3)> or 40*b077aed3SPierre ProncheryL<CMS_add0_recipient_key(3)>. 41*b077aed3SPierre Pronchery 42*b077aed3SPierre ProncheryThe B<CMS_ContentInfo> structure needs to be finalized using L<CMS_final(3)> 43*b077aed3SPierre Proncheryand then freed using L<CMS_ContentInfo_free(3)>. 44*b077aed3SPierre Pronchery 45*b077aed3SPierre ProncheryCMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create are similar to 46*b077aed3SPierre ProncheryCMS_EnvelopedData_create_ex() and 47*b077aed3SPierre ProncheryCMS_AuthEnvelopedData_create_ex() but use default values of NULL for 48*b077aed3SPierre Proncherythe library context I<libctx> and the property query I<propq>. 49*b077aed3SPierre Pronchery 50*b077aed3SPierre Pronchery=head1 NOTES 51*b077aed3SPierre Pronchery 52*b077aed3SPierre ProncheryAlthough CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() allocate 53*b077aed3SPierre Proncherya new B<CMS_ContentInfo> structure, they are not usually used in applications. 54*b077aed3SPierre ProncheryThe wrappers L<CMS_encrypt(3)> and L<CMS_decrypt(3)> are often used instead. 55*b077aed3SPierre Pronchery 56*b077aed3SPierre Pronchery=head1 RETURN VALUES 57*b077aed3SPierre Pronchery 58*b077aed3SPierre ProncheryIf the allocation fails, CMS_EnvelopedData_create() and 59*b077aed3SPierre ProncheryCMS_AuthEnvelopedData_create() return NULL and set an error code that can be 60*b077aed3SPierre Proncheryobtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly 61*b077aed3SPierre Proncheryallocated structure. 62*b077aed3SPierre Pronchery 63*b077aed3SPierre Pronchery=head1 SEE ALSO 64*b077aed3SPierre Pronchery 65*b077aed3SPierre ProncheryL<ERR_get_error(3)>, L<CMS_encrypt(3)>, L<CMS_decrypt(3)>, L<CMS_final(3)> 66*b077aed3SPierre Pronchery 67*b077aed3SPierre Pronchery=head1 HISTORY 68*b077aed3SPierre Pronchery 69*b077aed3SPierre ProncheryThe CMS_EnvelopedData_create_ex() method was added in OpenSSL 3.0. 70*b077aed3SPierre Pronchery 71*b077aed3SPierre Pronchery=head1 COPYRIGHT 72*b077aed3SPierre Pronchery 73*b077aed3SPierre ProncheryCopyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 74*b077aed3SPierre Pronchery 75*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 76*b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 77*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 78*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 79*b077aed3SPierre Pronchery 80*b077aed3SPierre Pronchery=cut 81