2
0

CMS_EnvelopedData_create.pod 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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, OPENSSL_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, OPENSSL_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
  34. CMS_AuthEnvelopedData_create_ex() 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() and CMS_AuthEnvelopedData_create() allocate
  38. a new B<CMS_ContentInfo> structure, they are not usually used in applications.
  39. The wrappers L<CMS_encrypt(3)> and L<CMS_decrypt(3)> are often used instead.
  40. =head1 RETURN VALUES
  41. If the allocation fails, CMS_EnvelopedData_create() and
  42. CMS_AuthEnvelopedData_create() return NULL and set an error code that can be
  43. obtained by L<ERR_get_error(3)>. Otherwise they return a pointer to the newly
  44. allocated structure.
  45. =head1 SEE ALSO
  46. L<ERR_get_error(3)>, L<CMS_encrypt(3)>, L<CMS_decrypt(3)>, L<CMS_final(3)>
  47. head1 HISTORY
  48. The CMS_EnvelopedData_create_ex() method was added in OpenSSL 3.0.
  49. =head1 COPYRIGHT
  50. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  51. Licensed under the Apache License 2.0 (the "License"). You may not use
  52. this file except in compliance with the License. You can obtain a copy
  53. in the file LICENSE in the source distribution or at
  54. L<https://www.openssl.org/source/license.html>.
  55. =cut