update libressl to v2.7.4
[unleashed.git] / lib / libcrypto / man / SMIME_write_PKCS7.3
bloba0a15763a1b1ff483734189624dcbeb762f6f10d
1 .\"     $OpenBSD: SMIME_write_PKCS7.3,v 1.5 2018/03/22 16:06:33 schwarze Exp $
2 .\"     OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3 .\"
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2002, 2003, 2006, 2007, 2015 The OpenSSL Project.
6 .\" All rights reserved.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\"
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\"
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\"    notice, this list of conditions and the following disclaimer in
17 .\"    the documentation and/or other materials provided with the
18 .\"    distribution.
19 .\"
20 .\" 3. All advertising materials mentioning features or use of this
21 .\"    software must display the following acknowledgment:
22 .\"    "This product includes software developed by the OpenSSL Project
23 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 .\"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\"    endorse or promote products derived from this software without
27 .\"    prior written permission. For written permission, please contact
28 .\"    openssl-core@openssl.org.
29 .\"
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\"    nor may "OpenSSL" appear in their names without prior written
32 .\"    permission of the OpenSSL Project.
33 .\"
34 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\"    acknowledgment:
36 .\"    "This product includes software developed by the OpenSSL Project
37 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
51 .\"
52 .Dd $Mdocdate: March 22 2018 $
53 .Dt SMIME_WRITE_PKCS7 3
54 .Os
55 .Sh NAME
56 .Nm SMIME_write_PKCS7
57 .Nd convert PKCS#7 structure to S/MIME format
58 .Sh SYNOPSIS
59 .In openssl/pkcs7.h
60 .Ft int
61 .Fo SMIME_write_PKCS7
62 .Fa "BIO *out"
63 .Fa "PKCS7 *p7"
64 .Fa "BIO *data"
65 .Fa "int flags"
66 .Fc
67 .Sh DESCRIPTION
68 .Fn SMIME_write_PKCS7
69 adds the appropriate MIME headers to a PKCS#7 structure to produce an
70 S/MIME message.
71 .Pp
72 .Fa out
73 is the
74 .Vt BIO
75 to write the data to.
76 .Fa p7
77 is the appropriate
78 .Vt PKCS7
79 structure.
80 If streaming is enabled, then the content must be supplied in the
81 .Fa data
82 argument.
83 .Fa flags
84 is an optional set of flags.
85 .Pp
86 The following flags can be passed in the
87 .Fa flags
88 parameter.
89 .Pp
91 .Dv PKCS7_DETACHED
92 is set, then cleartext signing will be used.
93 This option only makes sense for signedData where
94 .Dv PKCS7_DETACHED
95 is also set when
96 .Xr PKCS7_sign 3
97 is also called.
98 .Pp
99 If the
100 .Dv PKCS7_TEXT
101 flag is set, MIME headers for type
102 .Sy text/plain
103 are added to the content.
104 This only makes sense if
105 .Dv PKCS7_DETACHED
106 is also set.
108 If the
109 .Dv PKCS7_STREAM
110 flag is set, streaming is performed.
111 This flag should only be set if
112 .Dv PKCS7_STREAM
113 was also set in the previous call to
114 .Xr PKCS7_sign 3
116 .Xr PKCS7_encrypt 3 .
118 If cleartext signing is being used and
119 .Dv PKCS7_STREAM
120 is not set, then the data must be read twice: once to compute the
121 signature in
122 .Xr PKCS7_sign 3
123 and once to output the S/MIME message.
125 If streaming is performed, the content is output in BER format using
126 indefinite length constructed encoding except in the case of signed
127 data with detached content where the content is absent and DER
128 format is used.
129 .Sh RETURN VALUES
130 .Fn SMIME_write_PKCS7
131 returns 1 for success or 0 for failure.
132 .Sh SEE ALSO
133 .Xr ERR_get_error 3 ,
134 .Xr i2d_PKCS7_bio_stream 3 ,
135 .Xr PEM_write_PKCS7 3 ,
136 .Xr PKCS7_new 3 ,
137 .Xr SMIME_read_PKCS7 3
138 .Sh HISTORY
139 .Fn SMIME_write_PKCS7
140 first appeared in OpenSSL 0.9.5 and has been available since
141 .Ox 2.7 .
142 .Sh BUGS
143 .Fn SMIME_write_PKCS7
144 always base64 encodes PKCS#7 structures.
145 There should be an option to disable this.