1=pod 2 3=head1 NAME 4 5SMIME_write_ASN1_ex, SMIME_write_ASN1 6- convert structure to S/MIME format 7 8=head1 SYNOPSIS 9 10 #include <openssl/asn1.h> 11 12 int SMIME_write_ASN1_ex(BIO *out, ASN1_VALUE *val, BIO *data, int flags, 13 int ctype_nid, int econt_nid, 14 STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it, 15 OSSL_LIB_CTX *libctx, const char *propq); 16 17 int SMIME_write_ASN1(BIO *out, 18 ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid, 19 STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); 20 21=head1 DESCRIPTION 22 23SMIME_write_ASN1_ex() adds the appropriate MIME headers to an object 24structure to produce an S/MIME message. 25 26I<out> is the BIO to write the data to. I<value> is the appropriate ASN1_VALUE 27structure (either CMS_ContentInfo or PKCS7). If streaming is enabled then the 28content must be supplied via I<data>. 29I<flags> is an optional set of flags. I<ctype_nid> is the NID of the content 30type, I<econt_nid> is the NID of the embedded content type and I<mdalgs> is a 31list of signed data digestAlgorithms. Valid values that can be used by the 32ASN.1 structure I<it> are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). 33The library context I<libctx> and the property query I<propq> are used when 34retrieving algorithms from providers. 35 36=head1 NOTES 37 38The higher level functions L<SMIME_write_CMS(3)> and 39L<SMIME_write_PKCS7(3)> should be used instead of SMIME_write_ASN1(). 40 41The following flags can be passed in the B<flags> parameter. 42 43If B<CMS_DETACHED> is set then cleartext signing will be used, this option only 44makes sense for SignedData where B<CMS_DETACHED> is also set when the sign() 45method is called. 46 47If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to 48the content, this only makes sense if B<CMS_DETACHED> is also set. 49 50If the B<CMS_STREAM> flag is set streaming is performed. This flag should only 51be set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo 52or PKCS7 creation function. 53 54If cleartext signing is being used and B<CMS_STREAM> not set then the data must 55be read twice: once to compute the signature in sign method and once to output 56the S/MIME message. 57 58If streaming is performed the content is output in BER format using indefinite 59length constructed encoding except in the case of signed data with detached 60content where the content is absent and DER format is used. 61 62=head1 RETURN VALUES 63 64SMIME_write_ASN1_ex() and SMIME_write_ASN1() return 1 for success or 650 for failure. 66 67=head1 SEE ALSO 68 69L<ERR_get_error(3)>, 70L<SMIME_write_CMS(3)>, 71L<SMIME_write_PKCS7(3)> 72 73=head1 COPYRIGHT 74 75Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. 76 77Licensed under the Apache License 2.0 (the "License"). You may not use 78this file except in compliance with the License. You can obtain a copy 79in the file LICENSE in the source distribution or at 80L<https://www.openssl.org/source/license.html>. 81 82=cut 83