xref: /freebsd/crypto/openssl/doc/internal/man3/ossl_cms_sign_encrypt.pod (revision e7be843b4a162e68651d3911f0357ed464915629)
1=pod
2
3=head1 NAME
4
5ossl_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
20ossl_cms_sign_encrypt() creates a B<CMS_EnvelopedData> structure for recipients in
21I<enc_recip>.
22
23I<data> is signed using I<signcert> and I<signkey> to create B<CMS_SignedData>
24and then encrypted using I<enc_recip> to create B<CMS_EnvelopedData>.
25The library context I<libctx> and the property query I<propq> are used
26when retrieving algorithms from providers.
27
28I<certs> is an optional additional set of certificates to include in the
29B<CMS_SignedData> structure (e.g., any intermediate CAs in the chain of the signer certificate).
30
31I<sign_flags> is an optional set of flags for the signing operation.
32See L<CMS_sign_ex(3)> for more information.
33
34I<enc_flags> is an optional set of flags for the encryption operation.
35See L<CMS_encrypt_ex(3)> for more information.
36
37=head1 RETURN VALUES
38
39If the allocation fails, ossl_cms_sign_encrypt() returns NULL and
40sets an error code that can be obtained by L<ERR_get_error(3)>.
41Otherwise, it returns a pointer to the newly allocated structure.
42
43=head1 HISTORY
44
45ossl_cms_sign_encrypt() was added in OpenSSL 3.5.
46
47=head1 COPYRIGHT
48
49Copyright 2023-2025 - 2024 The OpenSSL Project Authors. All Rights Reserved.
50
51Licensed under the Apache License 2.0 (the "License").  You may not use
52this file except in compliance with the License.  You can obtain a copy
53in the file LICENSE in the source distribution or at
54L<https://www.openssl.org/source/license.html>.
55
56=cut
57