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