1 =pod 2 3 =head1 NAME 4 5 ossl_cms_sign_encrypt 6 - Create CMS envelope 7 8 =head1 SYNOPSIS 9 10 #include <openssl/cms.h> 11 12 CMS_EnvelopedData *ossl_cms_sign_encrypt(BIO *data, X509 *sign_cert, STACK_OF(X509) *certs, 13 EVP_PKEY *sign_key, unsigned int sign_flags, 14 STACK_OF(X509) *enc_recip, const EVP_CIPHER *cipher, 15 unsigned int enc_flags, OSSL_LIB_CTX *libctx, 16 const char *propq); 17 18 =head1 DESCRIPTION 19 20 ossl_cms_sign_encrypt() creates a B<CMS_EnvelopedData> structure for recipients in 21 I<enc_recip>. 22 23 I<data> is signed using I<signcert> and I<signkey> to create B<CMS_SignedData> 24 and then encrypted using I<enc_recip> to create B<CMS_EnvelopedData>. 25 The library context I<libctx> and the property query I<propq> are used 26 when retrieving algorithms from providers. 27 28 I<certs> is an optional additional set of certificates to include in the 29 B<CMS_SignedData> structure (e.g., any intermediate CAs in the chain of the signer certificate). 30 31 I<sign_flags> is an optional set of flags for the signing operation. 32 See L<CMS_sign_ex(3)> for more information. 33 34 I<enc_flags> is an optional set of flags for the encryption operation. 35 See L<CMS_encrypt_ex(3)> for more information. 36 37 =head1 RETURN VALUES 38 39 If the allocation fails, ossl_cms_sign_encrypt() returns NULL and 40 sets an error code that can be obtained by L<ERR_get_error(3)>. 41 Otherwise, it returns a pointer to the newly allocated structure. 42 43 =head1 HISTORY 44 45 ossl_cms_sign_encrypt() was added in OpenSSL 3.5. 46 47 =head1 COPYRIGHT 48 49 Copyright 2023-2025 - 2024 The OpenSSL Project Authors. All Rights Reserved. 50 51 Licensed under the Apache License 2.0 (the "License"). You may not use 52 this file except in compliance with the License. You can obtain a copy 53 in the file LICENSE in the source distribution or at 54 L<https://www.openssl.org/source/license.html>. 55 56 =cut 57