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_CMS - convert CMS structure to S/MIME format 6 1.1 christos 7 1.1 christos =head1 SYNOPSIS 8 1.1 christos 9 1.1 christos #include <openssl/cms.h> 10 1.1 christos 11 1.1 christos int SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); 12 1.1 christos 13 1.1 christos =head1 DESCRIPTION 14 1.1 christos 15 1.1 christos SMIME_write_CMS() adds the appropriate MIME headers to a CMS 16 1.1 christos structure to produce an S/MIME message. 17 1.1 christos 18 1.1 christos B<out> is the BIO to write the data to. B<cms> is the appropriate 19 1.1 christos B<CMS_ContentInfo> structure. If streaming is enabled then the content must be 20 1.1 christos supplied in the B<data> argument. B<flags> is an optional set of flags. 21 1.1 christos 22 1.1 christos =head1 NOTES 23 1.1 christos 24 1.1 christos The following flags can be passed in the B<flags> parameter. 25 1.1 christos 26 1.1 christos If B<CMS_DETACHED> is set then cleartext signing will be used, this option only 27 1.1 christos makes sense for SignedData where B<CMS_DETACHED> is also set when CMS_sign() is 28 1.1 christos called. 29 1.1 christos 30 1.1 christos If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to 31 1.1 christos the content, this only makes sense if B<CMS_DETACHED> is also set. 32 1.1 christos 33 1.1 christos If the B<CMS_STREAM> flag is set streaming is performed. This flag should only 34 1.1 christos be set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo 35 1.1 christos creation function. 36 1.1 christos 37 1.1 christos If cleartext signing is being used and B<CMS_STREAM> not set then the data must 38 1.1 christos be read twice: once to compute the signature in CMS_sign() and once to output 39 1.1 christos the S/MIME message. 40 1.1 christos 41 1.1 christos If streaming is performed the content is output in BER format using indefinite 42 1.1 christos length constructed encoding except in the case of signed data with detached 43 1.1 christos content where the content is absent and DER format is used. 44 1.1 christos 45 1.1 christos =head1 BUGS 46 1.1 christos 47 1.1 christos SMIME_write_CMS() always base64 encodes CMS structures, there should be an 48 1.1 christos option to disable this. 49 1.1 christos 50 1.1 christos =head1 RETURN VALUES 51 1.1 christos 52 1.1 christos SMIME_write_CMS() returns 1 for success or 0 for failure. 53 1.1 christos 54 1.1 christos =head1 SEE ALSO 55 1.1 christos 56 1.1 christos L<ERR_get_error(3)>, L<CMS_sign(3)>, 57 1.1 christos L<CMS_verify(3)>, L<CMS_encrypt(3)> 58 1.1 christos L<CMS_decrypt(3)> 59 1.1 christos 60 1.1 christos =head1 COPYRIGHT 61 1.1 christos 62 1.1 christos Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. 63 1.1 christos 64 1.1.1.2 christos Licensed under the Apache License 2.0 (the "License"). You may not use 65 1.1 christos this file except in compliance with the License. You can obtain a copy 66 1.1 christos in the file LICENSE in the source distribution or at 67 1.1 christos L<https://www.openssl.org/source/license.html>. 68 1.1 christos 69 1.1 christos =cut 70