]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/CMS_EncryptedData_encrypt.pod
Run the withlibctx.pl script
[thirdparty/openssl.git] / doc / man3 / CMS_EncryptedData_encrypt.pod
CommitLineData
dda4e259
SL
1=pod
2
3=head1 NAME
4
d8652be0 5CMS_EncryptedData_encrypt_ex, CMS_EncryptedData_encrypt
dda4e259
SL
6- Create CMS EncryptedData
7
8=head1 SYNOPSIS
9
10 #include <openssl/cms.h>
11
d8652be0
MC
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 OPENSSL_CTX *ctx,
18 const char *propq);
dda4e259
SL
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
24=head1 DESCRIPTION
25
d8652be0 26CMS_EncryptedData_encrypt_ex() creates a B<CMS_ContentInfo> structure
dda4e259
SL
27with a type B<NID_pkcs7_encrypted>. I<in> is a BIO containing the data to
28encrypt using I<cipher> and the encryption key I<key> of size I<keylen> bytes.
29The library context I<libctx> and the property query I<propq> are used when
30retrieving algorithms from providers. I<flags> is a set of optional flags.
31
32The I<flags> field supports the options B<CMS_DETACHED>, B<CMS_STREAM> and
33B<CMS_PARTIAL>. Internally CMS_final() is called unless B<CMS_STREAM> and/or
34B<CMS_PARTIAL> is specified.
35
36The algorithm passed in the I<cipher> parameter must support ASN1 encoding of
37its parameters.
38
39The B<CMS_ContentInfo> structure can be freed using L<CMS_ContentInfo_free(3)>.
40
d8652be0 41CMS_EncryptedData_encrypt() is similar to CMS_EncryptedData_encrypt_ex()
dda4e259
SL
42but uses default values of NULL for the library context I<libctx> and the
43property query I<propq>.
44
45=head1 RETURN VALUES
46
d8652be0 47If the allocation fails, CMS_EncryptedData_encrypt_ex() and
dda4e259
SL
48CMS_EncryptedData_encrypt() return NULL and set an error code that can be
49obtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly
50allocated structure.
51
52=head1 SEE ALSO
53
54L<ERR_get_error(3)>, L<CMS_final(3)>, L<CMS_EncryptedData_decrypt(3)>
55
56head1 HISTORY
57
d8652be0 58The CMS_EncryptedData_encrypt_ex() method was added in OpenSSL 3.0.
dda4e259
SL
59
60=head1 COPYRIGHT
61
62Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
63
64Licensed under the Apache License 2.0 (the "License"). You may not use
65this file except in compliance with the License. You can obtain a copy
66in the file LICENSE in the source distribution or at
67L<https://www.openssl.org/source/license.html>.
68
69=cut