1*b0d17251Schristos=pod 2*b0d17251Schristos 3*b0d17251Schristos=head1 NAME 4*b0d17251Schristos 5*b0d17251SchristosCMS_EncryptedData_encrypt_ex, CMS_EncryptedData_encrypt 6*b0d17251Schristos- Create CMS EncryptedData 7*b0d17251Schristos 8*b0d17251Schristos=head1 SYNOPSIS 9*b0d17251Schristos 10*b0d17251Schristos #include <openssl/cms.h> 11*b0d17251Schristos 12*b0d17251Schristos CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, 13*b0d17251Schristos const EVP_CIPHER *cipher, 14*b0d17251Schristos const unsigned char *key, 15*b0d17251Schristos size_t keylen, 16*b0d17251Schristos unsigned int flags, 17*b0d17251Schristos OSSL_LIB_CTX *ctx, 18*b0d17251Schristos const char *propq); 19*b0d17251Schristos 20*b0d17251Schristos CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, 21*b0d17251Schristos const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen, 22*b0d17251Schristos unsigned int flags); 23*b0d17251Schristos 24*b0d17251Schristos=head1 DESCRIPTION 25*b0d17251Schristos 26*b0d17251SchristosCMS_EncryptedData_encrypt_ex() creates a B<CMS_ContentInfo> structure 27*b0d17251Schristoswith a type B<NID_pkcs7_encrypted>. I<in> is a BIO containing the data to 28*b0d17251Schristosencrypt using I<cipher> and the encryption key I<key> of size I<keylen> bytes. 29*b0d17251SchristosThe library context I<libctx> and the property query I<propq> are used when 30*b0d17251Schristosretrieving algorithms from providers. I<flags> is a set of optional flags. 31*b0d17251Schristos 32*b0d17251SchristosThe I<flags> field supports the options B<CMS_DETACHED>, B<CMS_STREAM> and 33*b0d17251SchristosB<CMS_PARTIAL>. Internally CMS_final() is called unless B<CMS_STREAM> and/or 34*b0d17251SchristosB<CMS_PARTIAL> is specified. 35*b0d17251Schristos 36*b0d17251SchristosThe algorithm passed in the I<cipher> parameter must support ASN1 encoding of 37*b0d17251Schristosits parameters. 38*b0d17251Schristos 39*b0d17251SchristosThe B<CMS_ContentInfo> structure can be freed using L<CMS_ContentInfo_free(3)>. 40*b0d17251Schristos 41*b0d17251SchristosCMS_EncryptedData_encrypt() is similar to CMS_EncryptedData_encrypt_ex() 42*b0d17251Schristosbut uses default values of NULL for the library context I<libctx> and the 43*b0d17251Schristosproperty query I<propq>. 44*b0d17251Schristos 45*b0d17251Schristos=head1 RETURN VALUES 46*b0d17251Schristos 47*b0d17251SchristosIf the allocation fails, CMS_EncryptedData_encrypt_ex() and 48*b0d17251SchristosCMS_EncryptedData_encrypt() return NULL and set an error code that can be 49*b0d17251Schristosobtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly 50*b0d17251Schristosallocated structure. 51*b0d17251Schristos 52*b0d17251Schristos=head1 SEE ALSO 53*b0d17251Schristos 54*b0d17251SchristosL<ERR_get_error(3)>, L<CMS_final(3)>, L<CMS_EncryptedData_decrypt(3)> 55*b0d17251Schristos 56*b0d17251Schristos=head1 HISTORY 57*b0d17251Schristos 58*b0d17251SchristosThe CMS_EncryptedData_encrypt_ex() method was added in OpenSSL 3.0. 59*b0d17251Schristos 60*b0d17251Schristos=head1 COPYRIGHT 61*b0d17251Schristos 62*b0d17251SchristosCopyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 63*b0d17251Schristos 64*b0d17251SchristosLicensed under the Apache License 2.0 (the "License"). You may not use 65*b0d17251Schristosthis file except in compliance with the License. You can obtain a copy 66*b0d17251Schristosin the file LICENSE in the source distribution or at 67*b0d17251SchristosL<https://www.openssl.org/source/license.html>. 68*b0d17251Schristos 69*b0d17251Schristos=cut 70