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