1CMS_decrypt(3)                      OpenSSL                     CMS_decrypt(3)
2
3
4

NAME

6        CMS_decrypt - decrypt content from a CMS envelopedData structure
7

SYNOPSIS

9        #include <openssl/cms.h>
10
11        int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *dcont, BIO *out, unsigned int flags);
12

DESCRIPTION

14       CMS_decrypt() extracts and decrypts the content from a CMS
15       EnvelopedData structure. pkey is the private key of the recipient, cert
16       is the recipient's certificate, out is a BIO to write the content to
17       and flags is an optional set of flags.
18
19       The dcont parameter is used in the rare case where the encrypted
20       content is detached. It will normally be set to NULL.
21

NOTES

23       OpenSSL_add_all_algorithms() (or equivalent) should be called before
24       using this function or errors about unknown algorithms will occur.
25
26       Although the recipients certificate is not needed to decrypt the data
27       it is needed to locate the appropriate (of possible several) recipients
28       in the CMS structure. If cert is set to NULL all possible recipients
29       are tried.
30
31       It is possible to determine the correct recipient key by other means
32       (for example looking them up in a database) and setting them in the CMS
33       structure in advance using the CMS utility functions such as
34       CMS_set1_pkey(). In this case both cert and pkey should be set to NULL.
35
36       To process KEKRecipientInfo types CMS_set1_key() or
37       CMS_RecipientInfo_set0_key() and CMS_ReceipientInfo_decrypt() should be
38       called before CMS_decrypt() and cert and pkey set to NULL.
39
40       The following flags can be passed in the flags parameter.
41
42       If the CMS_TEXT flag is set MIME headers for type text/plain are
43       deleted from the content. If the content is not of type text/plain then
44       an error is returned.
45

RETURN VALUES

47       CMS_decrypt() returns either 1 for success or 0 for failure.  The error
48       can be obtained from ERR_get_error(3)
49

BUGS

51       The lack of single pass processing and the need to hold all data in
52       memory as mentioned in CMS_verify() also applies to CMS_decrypt().
53

SEE ALSO

55       ERR_get_error(3), CMS_encrypt(3)
56

HISTORY

58       CMS_decrypt() was added to OpenSSL 0.9.8
59
60
61
621.0.0e                            2008-04-11                    CMS_decrypt(3)
Impressum