xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/PKCS7_decrypt.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosPKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure
6*4724848cSchristos
7*4724848cSchristos=head1 SYNOPSIS
8*4724848cSchristos
9*4724848cSchristos #include <openssl/pkcs7.h>
10*4724848cSchristos
11*4724848cSchristos int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
12*4724848cSchristos
13*4724848cSchristos=head1 DESCRIPTION
14*4724848cSchristos
15*4724848cSchristosPKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData
16*4724848cSchristosstructure. B<pkey> is the private key of the recipient, B<cert> is the
17*4724848cSchristosrecipients certificate, B<data> is a BIO to write the content to and
18*4724848cSchristosB<flags> is an optional set of flags.
19*4724848cSchristos
20*4724848cSchristos=head1 NOTES
21*4724848cSchristos
22*4724848cSchristosAlthough the recipients certificate is not needed to decrypt the data it is needed
23*4724848cSchristosto locate the appropriate (of possible several) recipients in the PKCS#7 structure.
24*4724848cSchristos
25*4724848cSchristosThe following flags can be passed in the B<flags> parameter.
26*4724848cSchristos
27*4724848cSchristosIf the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted
28*4724848cSchristosfrom the content. If the content is not of type B<text/plain> then an error is
29*4724848cSchristosreturned.
30*4724848cSchristos
31*4724848cSchristos=head1 RETURN VALUES
32*4724848cSchristos
33*4724848cSchristosPKCS7_decrypt() returns either 1 for success or 0 for failure.
34*4724848cSchristosThe error can be obtained from ERR_get_error(3)
35*4724848cSchristos
36*4724848cSchristos=head1 BUGS
37*4724848cSchristos
38*4724848cSchristosPKCS7_decrypt() must be passed the correct recipient key and certificate. It would
39*4724848cSchristosbe better if it could look up the correct key and certificate from a database.
40*4724848cSchristos
41*4724848cSchristosThe lack of single pass processing and need to hold all data in memory as
42*4724848cSchristosmentioned in PKCS7_sign() also applies to PKCS7_verify().
43*4724848cSchristos
44*4724848cSchristos=head1 SEE ALSO
45*4724848cSchristos
46*4724848cSchristosL<ERR_get_error(3)>, L<PKCS7_encrypt(3)>
47*4724848cSchristos
48*4724848cSchristos=head1 COPYRIGHT
49*4724848cSchristos
50*4724848cSchristosCopyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
51*4724848cSchristos
52*4724848cSchristosLicensed under the OpenSSL license (the "License").  You may not use
53*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
54*4724848cSchristosin the file LICENSE in the source distribution or at
55*4724848cSchristosL<https://www.openssl.org/source/license.html>.
56*4724848cSchristos
57*4724848cSchristos=cut
58