1PKCS7_decrypt(3)                    OpenSSL                   PKCS7_decrypt(3)
2
3
4

NAME

6       PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure
7

SYNOPSIS

9        #include <openssl/pkcs7.h>
10
11        int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
12

DESCRIPTION

14       PKCS7_decrypt() extracts and decrypts the content from a PKCS#7
15       envelopedData structure. pkey is the private key of the recipient, cert
16       is the recipients certificate, data is a BIO to write the content to
17       and flags is an optional set of flags.
18

NOTES

20       OpenSSL_add_all_algorithms() (or equivalent) should be called before
21       using this function or errors about unknown algorithms will occur.
22
23       Although the recipients certificate is not needed to decrypt the data
24       it is needed to locate the appropriate (of possible several) recipients
25       in the PKCS#7 structure.
26
27       The following flags can be passed in the flags parameter.
28
29       If the PKCS7_TEXT flag is set MIME headers for type text/plain are
30       deleted from the content. If the content is not of type text/plain then
31       an error is returned.
32

RETURN VALUES

34       PKCS7_decrypt() returns either 1 for success or 0 for failure.  The
35       error can be obtained from ERR_get_error(3)
36

BUGS

38       PKCS7_decrypt() must be passed the correct recipient key and
39       certificate. It would be better if it could look up the correct key and
40       certificate from a database.
41
42       The lack of single pass processing and need to hold all data in memory
43       as mentioned in PKCS7_sign() also applies to PKCS7_verify().
44

SEE ALSO

46       ERR_get_error(3), PKCS7_encrypt(3)
47

HISTORY

49       PKCS7_decrypt() was added to OpenSSL 0.9.5
50
51
52
531.0.2o                            2019-09-10                  PKCS7_decrypt(3)
Impressum