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