CMS_EncryptedData_decrypt.pod 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. =pod
  2. =head1 NAME
  3. CMS_EncryptedData_decrypt, CMS_EnvelopedData_decrypt
  4. - Decrypt CMS EncryptedData or EnvelopedData
  5. =head1 SYNOPSIS
  6. #include <openssl/cms.h>
  7. int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
  8. const unsigned char *key, size_t keylen,
  9. BIO *dcont, BIO *out, unsigned int flags);
  10. BIO *CMS_EnvelopedData_decrypt(CMS_EnvelopedData *env, BIO *detached_data,
  11. EVP_PKEY *pkey, X509 *cert,
  12. ASN1_OCTET_STRING *secret, unsigned int flags,
  13. OSSL_LIB_CTX *libctx, const char *propq);
  14. =head1 DESCRIPTION
  15. CMS_EncryptedData_decrypt() decrypts a I<cms> EncryptedData object using the
  16. symmetric I<key> of size I<keylen> bytes. I<out> is a BIO to write the content
  17. to and I<flags> is an optional set of flags.
  18. I<dcont> is used in the rare case where the encrypted content is detached. It
  19. will normally be set to NULL.
  20. The following flags can be passed in the B<flags> parameter.
  21. If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted
  22. from the content. If the content is not of type B<text/plain> then an error is
  23. returned.
  24. CMS_EnvelopedData_decrypt() decrypts, similarly to CMS_decrypt(3),
  25. a CMS EnvelopedData object I<env> using the symmetric key I<secret> or
  26. the private key of the recipient B<pkey> and its associated certificate B<cert>.
  27. The optional parameters I<flags> and I<dcont> are used as described above.
  28. The optional parameters library context I<libctx> and property query I<propq>
  29. are used when retrieving algorithms from providers.
  30. =head1 RETURN VALUES
  31. CMS_EncryptedData_decrypt() returns 0 if an error occurred otherwise returns 1.
  32. CMS_EnvelopedData_decrypt() returns NULL if an error occurred,
  33. otherwise a BIO containing the decypted content.
  34. =head1 SEE ALSO
  35. L<ERR_get_error(3)>, L<CMS_EncryptedData_encrypt(3)>, L<CMS_decrypt(3)>
  36. =head1 HISTORY
  37. CMS_EnvelopedData_decrypt() was added in OpenSSL 3.1.
  38. =head1 COPYRIGHT
  39. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  40. Licensed under the Apache License 2.0 (the "License"). You may not use
  41. this file except in compliance with the License. You can obtain a copy
  42. in the file LICENSE in the source distribution or at
  43. L<https://www.openssl.org/source/license.html>.
  44. =cut