CMS_EnvelopedData_create.pod 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. =pod
  2. =head1 NAME
  3. CMS_EnvelopedData_create_ex, CMS_EnvelopedData_create,
  4. CMS_AuthEnvelopedData_create, CMS_AuthEnvelopedData_create_ex
  5. - Create CMS envelope
  6. =head1 SYNOPSIS
  7. #include <openssl/cms.h>
  8. CMS_ContentInfo *
  9. CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
  10. const char *propq);
  11. CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
  12. CMS_ContentInfo *
  13. CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
  14. const char *propq);
  15. CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);
  16. =head1 DESCRIPTION
  17. CMS_EnvelopedData_create_ex() creates a B<CMS_ContentInfo> structure
  18. with a type B<NID_pkcs7_enveloped>. I<cipher> is the symmetric cipher to use.
  19. The library context I<libctx> and the property query I<propq> are used when
  20. retrieving algorithms from providers.
  21. CMS_AuthEnvelopedData_create_ex() creates a B<CMS_ContentInfo>
  22. structure with a type B<NID_id_smime_ct_authEnvelopedData>. B<cipher> is the
  23. symmetric AEAD cipher to use. Currently only AES variants with GCM mode are
  24. supported. The library context I<libctx> and the property query I<propq> are
  25. used when retrieving algorithms from providers.
  26. The algorithm passed in the I<cipher> parameter must support ASN1 encoding of
  27. its parameters.
  28. The recipients can be added later using L<CMS_add1_recipient_cert(3)> or
  29. L<CMS_add0_recipient_key(3)>.
  30. The B<CMS_ContentInfo> structure needs to be finalized using L<CMS_final(3)>
  31. and then freed using L<CMS_ContentInfo_free(3)>.
  32. CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() are similar to
  33. CMS_EnvelopedData_create_ex() and CMS_AuthEnvelopedData_create_ex()
  34. but use default values of NULL for
  35. the library context I<libctx> and the property query I<propq>.
  36. =head1 NOTES
  37. Although CMS_EnvelopedData_create_ex(), and CMS_EnvelopedData_create(),
  38. CMS_AuthEnvelopedData_create_ex(), and CMS_AuthEnvelopedData_create() allocate
  39. a new B<CMS_ContentInfo> structure, they are not usually used in applications.
  40. The wrappers L<CMS_encrypt(3)> and L<CMS_decrypt(3)> are often used instead.
  41. =head1 RETURN VALUES
  42. If the allocation fails, CMS_EnvelopedData_create_ex(),
  43. CMS_EnvelopedData_create(), CMS_AuthEnvelopedData_create_ex(), and
  44. CMS_AuthEnvelopedData_create() return NULL and set an error code that can be
  45. obtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly
  46. allocated structure.
  47. =head1 SEE ALSO
  48. L<ERR_get_error(3)>, L<CMS_encrypt(3)>, L<CMS_decrypt(3)>, L<CMS_final(3)>
  49. =head1 HISTORY
  50. The CMS_EnvelopedData_create_ex() method was added in OpenSSL 3.0.
  51. =head1 COPYRIGHT
  52. Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
  53. Licensed under the Apache License 2.0 (the "License"). You may not use
  54. this file except in compliance with the License. You can obtain a copy
  55. in the file LICENSE in the source distribution or at
  56. L<https://www.openssl.org/source/license.html>.
  57. =cut