1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimPKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/pkcs7.h> 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); 12e71b7053SJung-uk Kim 13e71b7053SJung-uk Kim=head1 DESCRIPTION 14e71b7053SJung-uk Kim 15e71b7053SJung-uk KimPKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData 16e71b7053SJung-uk Kimstructure. B<pkey> is the private key of the recipient, B<cert> is the 17e71b7053SJung-uk Kimrecipients certificate, B<data> is a BIO to write the content to and 18e71b7053SJung-uk KimB<flags> is an optional set of flags. 19e71b7053SJung-uk Kim 20e71b7053SJung-uk Kim=head1 NOTES 21e71b7053SJung-uk Kim 22e71b7053SJung-uk KimAlthough the recipients certificate is not needed to decrypt the data it is needed 23e71b7053SJung-uk Kimto locate the appropriate (of possible several) recipients in the PKCS#7 structure. 24e71b7053SJung-uk Kim 25e71b7053SJung-uk KimThe following flags can be passed in the B<flags> parameter. 26e71b7053SJung-uk Kim 27e71b7053SJung-uk KimIf the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted 28e71b7053SJung-uk Kimfrom the content. If the content is not of type B<text/plain> then an error is 29e71b7053SJung-uk Kimreturned. 30e71b7053SJung-uk Kim 31e71b7053SJung-uk Kim=head1 RETURN VALUES 32e71b7053SJung-uk Kim 33e71b7053SJung-uk KimPKCS7_decrypt() returns either 1 for success or 0 for failure. 34e71b7053SJung-uk KimThe error can be obtained from ERR_get_error(3) 35e71b7053SJung-uk Kim 36e71b7053SJung-uk Kim=head1 BUGS 37e71b7053SJung-uk Kim 38e71b7053SJung-uk KimPKCS7_decrypt() must be passed the correct recipient key and certificate. It would 39e71b7053SJung-uk Kimbe better if it could look up the correct key and certificate from a database. 40e71b7053SJung-uk Kim 41e71b7053SJung-uk KimThe lack of single pass processing and need to hold all data in memory as 42e71b7053SJung-uk Kimmentioned in PKCS7_sign() also applies to PKCS7_verify(). 43e71b7053SJung-uk Kim 44e71b7053SJung-uk Kim=head1 SEE ALSO 45e71b7053SJung-uk Kim 46e71b7053SJung-uk KimL<ERR_get_error(3)>, L<PKCS7_encrypt(3)> 47e71b7053SJung-uk Kim 48e71b7053SJung-uk Kim=head1 COPYRIGHT 49e71b7053SJung-uk Kim 50e71b7053SJung-uk KimCopyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 51e71b7053SJung-uk Kim 52*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 53e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 54e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 55e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 56e71b7053SJung-uk Kim 57e71b7053SJung-uk Kim=cut 58