SMIME_write_ASN1.pod 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. =pod
  2. =head1 NAME
  3. SMIME_write_ASN1_ex, SMIME_write_ASN1
  4. - convert structure to S/MIME format
  5. =head1 SYNOPSIS
  6. #include <openssl/asn1.h>
  7. int SMIME_write_ASN1_ex(BIO *out, ASN1_VALUE *val, BIO *data, int flags,
  8. int ctype_nid, int econt_nid,
  9. STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it,
  10. OSSL_LIB_CTX *libctx, const char *propq);
  11. int SMIME_write_ASN1(BIO *out,
  12. ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid,
  13. STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);
  14. =head1 DESCRIPTION
  15. SMIME_write_ASN1_ex() adds the appropriate MIME headers to an object
  16. structure to produce an S/MIME message.
  17. I<out> is the BIO to write the data to. I<value> is the appropriate ASN1_VALUE
  18. structure (either CMS_ContentInfo or PKCS7). If streaming is enabled then the
  19. content must be supplied via I<data>.
  20. I<flags> is an optional set of flags. I<ctype_nid> is the NID of the content
  21. type, I<econt_nid> is the NID of the embedded content type and I<mdalgs> is a
  22. list of signed data digestAlgorithms. Valid values that can be used by the
  23. ASN.1 structure I<it> are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo).
  24. The library context I<libctx> and the property query I<propq> are used when
  25. retrieving algorithms from providers.
  26. =head1 NOTES
  27. The higher level functions L<SMIME_write_CMS(3)> and
  28. L<SMIME_write_PKCS7(3)> should be used instead of SMIME_write_ASN1().
  29. The following flags can be passed in the B<flags> parameter.
  30. If B<CMS_DETACHED> is set then cleartext signing will be used, this option only
  31. makes sense for SignedData where B<CMS_DETACHED> is also set when the sign()
  32. method is called.
  33. If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to
  34. the content, this only makes sense if B<CMS_DETACHED> is also set.
  35. If the B<CMS_STREAM> flag is set streaming is performed. This flag should only
  36. be set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo
  37. or PKCS7 creation function.
  38. If cleartext signing is being used and B<CMS_STREAM> not set then the data must
  39. be read twice: once to compute the signature in sign method and once to output
  40. the S/MIME message.
  41. If streaming is performed the content is output in BER format using indefinite
  42. length constructed encoding except in the case of signed data with detached
  43. content where the content is absent and DER format is used.
  44. =head1 RETURN VALUES
  45. SMIME_write_ASN1_ex() and SMIME_write_ASN1() return 1 for success or
  46. 0 for failure.
  47. =head1 SEE ALSO
  48. L<ERR_get_error(3)>,
  49. L<SMIME_write_CMS(3)>,
  50. L<SMIME_write_PKCS7(3)>
  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