CMS_EncryptedData_encrypt.pod 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. =pod
  2. =head1 NAME
  3. CMS_EncryptedData_encrypt_ex, CMS_EncryptedData_encrypt
  4. - Create CMS EncryptedData
  5. =head1 SYNOPSIS
  6. #include <openssl/cms.h>
  7. CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in,
  8. const EVP_CIPHER *cipher,
  9. const unsigned char *key,
  10. size_t keylen,
  11. unsigned int flags,
  12. OPENSSL_CTX *ctx,
  13. const char *propq);
  14. CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in,
  15. const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen,
  16. unsigned int flags);
  17. =head1 DESCRIPTION
  18. CMS_EncryptedData_encrypt_ex() creates a B<CMS_ContentInfo> structure
  19. with a type B<NID_pkcs7_encrypted>. I<in> is a BIO containing the data to
  20. encrypt using I<cipher> and the encryption key I<key> of size I<keylen> bytes.
  21. The library context I<libctx> and the property query I<propq> are used when
  22. retrieving algorithms from providers. I<flags> is a set of optional flags.
  23. The I<flags> field supports the options B<CMS_DETACHED>, B<CMS_STREAM> and
  24. B<CMS_PARTIAL>. Internally CMS_final() is called unless B<CMS_STREAM> and/or
  25. B<CMS_PARTIAL> is specified.
  26. The algorithm passed in the I<cipher> parameter must support ASN1 encoding of
  27. its parameters.
  28. The B<CMS_ContentInfo> structure can be freed using L<CMS_ContentInfo_free(3)>.
  29. CMS_EncryptedData_encrypt() is similar to CMS_EncryptedData_encrypt_ex()
  30. but uses default values of NULL for the library context I<libctx> and the
  31. property query I<propq>.
  32. =head1 RETURN VALUES
  33. If the allocation fails, CMS_EncryptedData_encrypt_ex() and
  34. CMS_EncryptedData_encrypt() return NULL and set an error code that can be
  35. obtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly
  36. allocated structure.
  37. =head1 SEE ALSO
  38. L<ERR_get_error(3)>, L<CMS_final(3)>, L<CMS_EncryptedData_decrypt(3)>
  39. head1 HISTORY
  40. The CMS_EncryptedData_encrypt_ex() method was added in OpenSSL 3.0.
  41. =head1 COPYRIGHT
  42. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  43. Licensed under the Apache License 2.0 (the "License"). You may not use
  44. this file except in compliance with the License. You can obtain a copy
  45. in the file LICENSE in the source distribution or at
  46. L<https://www.openssl.org/source/license.html>.
  47. =cut