113d40330Schristos=pod 213d40330Schristos 313d40330Schristos=head1 NAME 413d40330Schristos 513d40330SchristosPKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure 613d40330Schristos 713d40330Schristos=head1 SYNOPSIS 813d40330Schristos 913d40330Schristos #include <openssl/pkcs7.h> 1013d40330Schristos 1113d40330Schristos int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); 1213d40330Schristos 1313d40330Schristos=head1 DESCRIPTION 1413d40330Schristos 1513d40330SchristosPKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData 1613d40330Schristosstructure. B<pkey> is the private key of the recipient, B<cert> is the 1713d40330Schristosrecipients certificate, B<data> is a BIO to write the content to and 1813d40330SchristosB<flags> is an optional set of flags. 1913d40330Schristos 2013d40330Schristos=head1 NOTES 2113d40330Schristos 2213d40330SchristosAlthough the recipients certificate is not needed to decrypt the data it is needed 2313d40330Schristosto locate the appropriate (of possible several) recipients in the PKCS#7 structure. 2413d40330Schristos 2513d40330SchristosThe following flags can be passed in the B<flags> parameter. 2613d40330Schristos 2713d40330SchristosIf the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted 2813d40330Schristosfrom the content. If the content is not of type B<text/plain> then an error is 2913d40330Schristosreturned. 3013d40330Schristos 3113d40330Schristos=head1 RETURN VALUES 3213d40330Schristos 3313d40330SchristosPKCS7_decrypt() returns either 1 for success or 0 for failure. 3413d40330SchristosThe error can be obtained from ERR_get_error(3) 3513d40330Schristos 3613d40330Schristos=head1 BUGS 3713d40330Schristos 3813d40330SchristosPKCS7_decrypt() must be passed the correct recipient key and certificate. It would 3913d40330Schristosbe better if it could look up the correct key and certificate from a database. 4013d40330Schristos 4113d40330SchristosThe lack of single pass processing and need to hold all data in memory as 4213d40330Schristosmentioned in PKCS7_sign() also applies to PKCS7_verify(). 4313d40330Schristos 4413d40330Schristos=head1 SEE ALSO 4513d40330Schristos 4613d40330SchristosL<ERR_get_error(3)>, L<PKCS7_encrypt(3)> 4713d40330Schristos 4813d40330Schristos=head1 COPYRIGHT 4913d40330Schristos 5013d40330SchristosCopyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 5113d40330Schristos 52*b0d17251SchristosLicensed under the Apache License 2.0 (the "License"). You may not use 5313d40330Schristosthis file except in compliance with the License. You can obtain a copy 5413d40330Schristosin the file LICENSE in the source distribution or at 5513d40330SchristosL<https://www.openssl.org/source/license.html>. 5613d40330Schristos 5713d40330Schristos=cut 58