1PKCS7_DECRYPT(3) OpenSSL PKCS7_DECRYPT(3)
2
3
4
6 PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure
7
9 #include <openssl/pkcs7.h>
10
11 int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
12
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
20 Although the recipients certificate is not needed to decrypt the data
21 it is needed to locate the appropriate (of possible several) recipients
22 in the PKCS#7 structure.
23
24 The following flags can be passed in the flags parameter.
25
26 If the PKCS7_TEXT flag is set MIME headers for type text/plain are
27 deleted from the content. If the content is not of type text/plain then
28 an error is returned.
29
31 PKCS7_decrypt() returns either 1 for success or 0 for failure. The
32 error can be obtained from ERR_get_error(3)
33
35 PKCS7_decrypt() must be passed the correct recipient key and
36 certificate. It would be better if it could look up the correct key and
37 certificate from a database.
38
39 The lack of single pass processing and need to hold all data in memory
40 as mentioned in PKCS7_sign() also applies to PKCS7_verify().
41
43 ERR_get_error(3), PKCS7_encrypt(3)
44
46 Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
47
48 Licensed under the OpenSSL license (the "License"). You may not use
49 this file except in compliance with the License. You can obtain a copy
50 in the file LICENSE in the source distribution or at
51 <https://www.openssl.org/source/license.html>.
52
53
54
551.1.1i 2021-07-22 PKCS7_DECRYPT(3)