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