xref: /freebsd/crypto/openssl/doc/man3/CMS_EncryptedData_decrypt.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncheryCMS_EncryptedData_decrypt
6*b077aed3SPierre Pronchery- Decrypt CMS EncryptedData
7*b077aed3SPierre Pronchery
8*b077aed3SPierre Pronchery=head1 SYNOPSIS
9*b077aed3SPierre Pronchery
10*b077aed3SPierre Pronchery #include <openssl/cms.h>
11*b077aed3SPierre Pronchery
12*b077aed3SPierre Pronchery int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
13*b077aed3SPierre Pronchery                               const unsigned char *key, size_t keylen,
14*b077aed3SPierre Pronchery                               BIO *dcont, BIO *out, unsigned int flags);
15*b077aed3SPierre Pronchery
16*b077aed3SPierre Pronchery=head1 DESCRIPTION
17*b077aed3SPierre Pronchery
18*b077aed3SPierre ProncheryCMS_EncryptedData_decrypt() decrypts a I<cms> EncryptedData object using the
19*b077aed3SPierre Proncherysymmetric I<key> of size I<keylen> bytes. I<out> is a BIO to write the content
20*b077aed3SPierre Proncheryto and I<flags> is an optional set of flags.
21*b077aed3SPierre ProncheryI<dcont> is used in the rare case where the encrypted content is detached. It
22*b077aed3SPierre Proncherywill normally be set to NULL.
23*b077aed3SPierre Pronchery
24*b077aed3SPierre ProncheryThe following flags can be passed in the I<flags> parameter.
25*b077aed3SPierre Pronchery
26*b077aed3SPierre ProncheryIf the B<CMS_TEXT> flag is set MIME headers for type C<text/plain> are deleted
27*b077aed3SPierre Proncheryfrom the content. If the content is not of type C<text/plain> then an error is
28*b077aed3SPierre Proncheryreturned.
29*b077aed3SPierre Pronchery
30*b077aed3SPierre Pronchery=head1 RETURN VALUES
31*b077aed3SPierre Pronchery
32*b077aed3SPierre ProncheryCMS_EncryptedData_decrypt() returns 0 if an error occurred otherwise it
33*b077aed3SPierre Proncheryreturns 1.
34*b077aed3SPierre Pronchery
35*b077aed3SPierre Pronchery=head1 SEE ALSO
36*b077aed3SPierre Pronchery
37*b077aed3SPierre ProncheryL<ERR_get_error(3)>, L<CMS_EncryptedData_encrypt(3)>
38*b077aed3SPierre Pronchery
39*b077aed3SPierre Pronchery
40*b077aed3SPierre Pronchery=head1 COPYRIGHT
41*b077aed3SPierre Pronchery
42*b077aed3SPierre ProncheryCopyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.
43*b077aed3SPierre Pronchery
44*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
45*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
46*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
47*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
48*b077aed3SPierre Pronchery
49*b077aed3SPierre Pronchery=cut
50