2
0

CMS_decrypt.pod 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. =pod
  2. =head1 NAME
  3. CMS_decrypt - decrypt content from a CMS envelopedData structure
  4. =head1 SYNOPSIS
  5. #include <openssl/cms.h>
  6. int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *dcont, BIO *out, unsigned int flags);
  7. =head1 DESCRIPTION
  8. CMS_decrypt() extracts and decrypts the content from a CMS EnvelopedData
  9. structure. B<pkey> is the private key of the recipient, B<cert> is the
  10. recipient's certificate, B<out> is a BIO to write the content to and
  11. B<flags> is an optional set of flags.
  12. The B<dcont> parameter is used in the rare case where the encrypted content
  13. is detached. It will normally be set to NULL.
  14. =head1 NOTES
  15. OpenSSL_add_all_algorithms() (or equivalent) should be called before using this
  16. function or errors about unknown algorithms will occur.
  17. Although the recipients certificate is not needed to decrypt the data it is
  18. needed to locate the appropriate (of possible several) recipients in the CMS
  19. structure. If B<cert> is set to NULL all possible recipients are tried.
  20. It is possible to determine the correct recipient key by other means (for
  21. example looking them up in a database) and setting them in the CMS structure
  22. in advance using the CMS utility functions such as CMS_set1_pkey(). In this
  23. case both B<cert> and B<pkey> should be set to NULL.
  24. To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0_key()
  25. and CMS_ReceipientInfo_decrypt() should be called before CMS_decrypt() and
  26. B<cert> and B<pkey> set to NULL.
  27. The following flags can be passed in the B<flags> parameter.
  28. If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted
  29. from the content. If the content is not of type B<text/plain> then an error is
  30. returned.
  31. =head1 RETURN VALUES
  32. CMS_decrypt() returns either 1 for success or 0 for failure.
  33. The error can be obtained from ERR_get_error(3)
  34. =head1 BUGS
  35. The lack of single pass processing and the need to hold all data in memory as
  36. mentioned in CMS_verify() also applies to CMS_decrypt().
  37. =head1 SEE ALSO
  38. L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
  39. =head1 HISTORY
  40. CMS_decrypt() was added to OpenSSL 0.9.8
  41. =cut