1CMS_ENCRYPTEDDATA_ENCRYPT(3ossl)    OpenSSL   CMS_ENCRYPTEDDATA_ENCRYPT(3ossl)
2
3
4

NAME

6       CMS_EncryptedData_encrypt_ex, CMS_EncryptedData_encrypt - Create CMS
7       EncryptedData
8

SYNOPSIS

10        #include <openssl/cms.h>
11
12        CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in,
13                                                      const EVP_CIPHER *cipher,
14                                                      const unsigned char *key,
15                                                      size_t keylen,
16                                                      unsigned int flags,
17                                                      OSSL_LIB_CTX *ctx,
18                                                      const char *propq);
19
20        CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in,
21            const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen,
22            unsigned int flags);
23

DESCRIPTION

25       CMS_EncryptedData_encrypt_ex() creates a CMS_ContentInfo structure with
26       a type NID_pkcs7_encrypted. in is a BIO containing the data to encrypt
27       using cipher and the encryption key key of size keylen bytes.  The
28       library context libctx and the property query propq are used when
29       retrieving algorithms from providers. flags is a set of optional flags.
30
31       The flags field supports the options CMS_DETACHED, CMS_STREAM and
32       CMS_PARTIAL. Internally CMS_final() is called unless CMS_STREAM and/or
33       CMS_PARTIAL is specified.
34
35       The algorithm passed in the cipher parameter must support ASN1 encoding
36       of its parameters.
37
38       The CMS_ContentInfo structure can be freed using
39       CMS_ContentInfo_free(3).
40
41       CMS_EncryptedData_encrypt() is similar to
42       CMS_EncryptedData_encrypt_ex() but uses default values of NULL for the
43       library context libctx and the property query propq.
44

RETURN VALUES

46       If the allocation fails, CMS_EncryptedData_encrypt_ex() and
47       CMS_EncryptedData_encrypt() return NULL and set an error code that can
48       be obtained by ERR_get_error(3). Otherwise they return a pointer to the
49       newly allocated structure.
50

SEE ALSO

52       ERR_get_error(3), CMS_final(3), CMS_EncryptedData_decrypt(3)
53

HISTORY

55       The CMS_EncryptedData_encrypt_ex() method was added in OpenSSL 3.0.
56
58       Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
59
60       Licensed under the Apache License 2.0 (the "License").  You may not use
61       this file except in compliance with the License.  You can obtain a copy
62       in the file LICENSE in the source distribution or at
63       <https://www.openssl.org/source/license.html>.
64
65
66
673.0.9                             2023-07-27  CMS_ENCRYPTEDDATA_ENCRYPT(3ossl)
Impressum