CMS_EnvelopedData_create.pod 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. =pod
  2. =head1 NAME
  3. CMS_EnvelopedData_create_with_libctx, CMS_EnvelopedData_create,
  4. CMS_AuthEnvelopedData_create, CMS_AuthEnvelopedData_create_with_libctx
  5. - Create CMS envelope
  6. =head1 SYNOPSIS
  7. #include <openssl/cms.h>
  8. CMS_ContentInfo *
  9. CMS_EnvelopedData_create_with_libctx(const EVP_CIPHER *cipher,
  10. OPENSSL_CTX *libctx,
  11. const char *propq);
  12. CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
  13. CMS_ContentInfo *
  14. CMS_AuthEnvelopedData_create_with_libctx(const EVP_CIPHER *cipher,
  15. OPENSSL_CTX *libctx,
  16. const char *propq);
  17. CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);
  18. =head1 DESCRIPTION
  19. CMS_EnvelopedData_create_with_libctx() creates a B<CMS_ContentInfo> structure
  20. with a type B<NID_pkcs7_enveloped>. I<cipher> is the symmetric cipher to use.
  21. The library context I<libctx> and the property query I<propq> are used when
  22. retrieving algorithms from providers.
  23. CMS_AuthEnvelopedData_create_with_libctx() creates a B<CMS_ContentInfo>
  24. structure with a type B<NID_id_smime_ct_authEnvelopedData>. B<cipher> is the
  25. symmetric AEAD cipher to use. Currently only AES variants with GCM mode are
  26. supported. The library context I<libctx> and the property query I<propq> are
  27. used when retrieving algorithms from providers.
  28. The algorithm passed in the I<cipher> parameter must support ASN1 encoding of
  29. its parameters.
  30. The recipients can be added later using L<CMS_add1_recipient_cert(3)> or
  31. L<CMS_add0_recipient_key(3)>.
  32. The B<CMS_ContentInfo> structure needs to be finalized using L<CMS_final(3)>
  33. and then freed using L<CMS_ContentInfo_free(3)>.
  34. CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create are similar to
  35. CMS_EnvelopedData_create_with_libctx() and
  36. CMS_AuthEnvelopedData_create_with_libctx() but use default values of NULL for
  37. the library context I<libctx> and the property query I<propq>.
  38. =head1 NOTES
  39. Although CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() allocate
  40. a new B<CMS_ContentInfo> structure, they are not usually used in applications.
  41. The wrappers L<CMS_encrypt(3)> and L<CMS_decrypt(3)> are often used instead.
  42. =head1 RETURN VALUES
  43. If the allocation fails, CMS_EnvelopedData_create() 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_with_libctx() method was added in OpenSSL 3.0.
  51. =head1 COPYRIGHT
  52. Copyright 2020 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