diff options
Diffstat (limited to 'src/lib/libcrypto/man/SMIME_write_PKCS7.3')
-rw-r--r-- | src/lib/libcrypto/man/SMIME_write_PKCS7.3 | 152 |
1 files changed, 98 insertions, 54 deletions
diff --git a/src/lib/libcrypto/man/SMIME_write_PKCS7.3 b/src/lib/libcrypto/man/SMIME_write_PKCS7.3 index c1a9f051d0..5e344d9c63 100644 --- a/src/lib/libcrypto/man/SMIME_write_PKCS7.3 +++ b/src/lib/libcrypto/man/SMIME_write_PKCS7.3 | |||
@@ -1,10 +1,10 @@ | |||
1 | .\" $OpenBSD: SMIME_write_PKCS7.3,v 1.9 2021/12/14 15:46:48 schwarze Exp $ | 1 | .\" $OpenBSD: SMIME_write_PKCS7.3,v 1.12 2025/06/11 23:16:32 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
3 | .\" | 3 | .\" |
4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
5 | .\" The changes are covered by the following Copyright and license: | 5 | .\" The changes are covered by the following Copyright and license: |
6 | .\" | 6 | .\" |
7 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 7 | .\" Copyright (c) 2021, 2025 Ingo Schwarze <schwarze@openbsd.org> |
8 | .\" | 8 | .\" |
9 | .\" Permission to use, copy, modify, and distribute this software for any | 9 | .\" Permission to use, copy, modify, and distribute this software for any |
10 | .\" purpose with or without fee is hereby granted, provided that the above | 10 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -66,13 +66,14 @@ | |||
66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
68 | .\" | 68 | .\" |
69 | .Dd $Mdocdate: December 14 2021 $ | 69 | .Dd $Mdocdate: June 11 2025 $ |
70 | .Dt SMIME_WRITE_PKCS7 3 | 70 | .Dt SMIME_WRITE_PKCS7 3 |
71 | .Os | 71 | .Os |
72 | .Sh NAME | 72 | .Sh NAME |
73 | .Nm SMIME_write_PKCS7 | 73 | .Nm SMIME_write_PKCS7 |
74 | .Nd convert PKCS#7 structure to S/MIME format | 74 | .Nd convert PKCS#7 structure to S/MIME format |
75 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
76 | .Lb libcrypto | ||
76 | .In openssl/pkcs7.h | 77 | .In openssl/pkcs7.h |
77 | .Ft int | 78 | .Ft int |
78 | .Fo SMIME_write_PKCS7 | 79 | .Fo SMIME_write_PKCS7 |
@@ -83,48 +84,81 @@ | |||
83 | .Fc | 84 | .Fc |
84 | .Sh DESCRIPTION | 85 | .Sh DESCRIPTION |
85 | .Fn SMIME_write_PKCS7 | 86 | .Fn SMIME_write_PKCS7 |
86 | adds the appropriate MIME headers to a PKCS#7 structure to produce an | 87 | generates an S/MIME message on |
87 | S/MIME message. | ||
88 | .Pp | ||
89 | .Fa out | 88 | .Fa out |
90 | is the | 89 | by writing MIME 1.0 headers |
91 | .Vt BIO | 90 | followed by a BER- and base64-encoded serialization of |
92 | to write the data to. | 91 | .Fa p7 . |
93 | .Fa p7 | 92 | The BER encoding uses the DER format except as described for |
94 | is the appropriate | 93 | .Dv PKCS7_STREAM |
95 | .Vt PKCS7 | 94 | below. |
96 | structure. | ||
97 | If streaming is enabled, then the content must be supplied in the | 95 | If streaming is enabled, then the content must be supplied in the |
98 | .Fa data | 96 | .Fa data |
99 | argument. | 97 | argument. |
100 | .Fa flags | ||
101 | is an optional set of flags. | ||
102 | .Pp | 98 | .Pp |
103 | The following flags can be passed in the | 99 | The |
104 | .Fa flags | 100 | .Fa flags |
105 | parameter. | 101 | can be the logical OR of zero or more of the following bits: |
106 | .Pp | 102 | .Bl -tag -width Ds |
103 | .It Dv PKCS7_DETACHED | ||
104 | Use cleartext signing and generate a | ||
105 | .Qq multipart/signed | ||
106 | S/MIME message. | ||
107 | The content is read from | ||
108 | .Fa data . | ||
107 | If | 109 | If |
108 | .Dv PKCS7_DETACHED | 110 | .Fa data |
109 | is set, then cleartext signing will be used. | 111 | is a |
110 | This option only makes sense for signedData where | 112 | .Dv NULL |
113 | pointer, this flag is ignored. | ||
114 | .Pp | ||
115 | This flag is only supported for signedData where | ||
111 | .Dv PKCS7_DETACHED | 116 | .Dv PKCS7_DETACHED |
112 | is also set when | 117 | is also set when |
113 | .Xr PKCS7_sign 3 | 118 | .Xr PKCS7_sign 3 |
114 | is also called. | 119 | is called. |
115 | .Pp | 120 | .Pp |
116 | If the | 121 | If |
117 | .Dv PKCS7_TEXT | 122 | .Dv PKCS7_STREAM |
118 | flag is set, MIME headers for type | 123 | is not set, the data must be read twice: once to compute the |
119 | .Sy text/plain | 124 | signature in |
120 | are added to the content. | 125 | .Xr PKCS7_sign 3 |
121 | This only makes sense if | 126 | and once to output the S/MIME message. |
127 | .Pp | ||
128 | If | ||
129 | .Dv PKCS7_DETACHED | ||
130 | is ignored or not specified, the smime-type is chosen according to the type of | ||
131 | .Fa p7 : | ||
132 | .Bl -tag -width Ds | ||
133 | .It Dv NID_pkcs7_enveloped | ||
134 | .Qq enveloped-data | ||
135 | .It Dv NID_pkcs7_signed | ||
136 | .Bl -tag -width Msigned-dataM -compact | ||
137 | .It Qq signed-data | ||
138 | if | ||
139 | .Fa p7 | ||
140 | specifies any digest algorithm | ||
141 | .It Qq certs-only | ||
142 | otherwise | ||
143 | .El | ||
144 | .It Dv NID_id_smime_ct_compressedData | ||
145 | .Qq compressed-data | ||
146 | .El | ||
147 | .It Dv PKCS7_REUSE_DIGEST | ||
148 | Skip the calls to | ||
149 | .Xr PKCS7_dataInit 3 | ||
150 | and | ||
151 | .Xr PKCS7_dataFinal 3 . | ||
152 | This flag has no effect unless | ||
122 | .Dv PKCS7_DETACHED | 153 | .Dv PKCS7_DETACHED |
123 | is also set. | 154 | is also set. |
155 | .It Dv PKCS7_STREAM | ||
156 | Perform streaming by reading the content from | ||
157 | .Fa data . | ||
158 | This only works if | ||
159 | .Dv PKCS7_DETACHED | ||
160 | is not specified. | ||
124 | .Pp | 161 | .Pp |
125 | If the | ||
126 | .Dv PKCS7_STREAM | ||
127 | flag is set, streaming is performed. | ||
128 | This flag should only be set if | 162 | This flag should only be set if |
129 | .Dv PKCS7_STREAM | 163 | .Dv PKCS7_STREAM |
130 | was also set in the previous call to | 164 | was also set in the previous call to |
@@ -132,13 +166,28 @@ was also set in the previous call to | |||
132 | or | 166 | or |
133 | .Xr PKCS7_encrypt 3 . | 167 | .Xr PKCS7_encrypt 3 . |
134 | .Pp | 168 | .Pp |
135 | The bit | 169 | The content is output in BER format using indefinite length constructed |
136 | .Dv SMIME_OLDMIME | 170 | encoding except in the case of signed data with detached content |
137 | is inverted before passing on the | 171 | where the content is absent and DER format is used. |
138 | .Fa flags | 172 | .It Dv PKCS7_TEXT |
139 | to | 173 | Prepend the line |
140 | .Xr SMIME_write_ASN1 3 . | 174 | .Qq Content-Type: text/plain |
141 | Consequently, if this bit is set in the | 175 | to the content. |
176 | This only makes sense if | ||
177 | .Dv PKCS7_DETACHED | ||
178 | is also set. | ||
179 | It is ignored if the flag | ||
180 | .Dv SMIME_BINARY | ||
181 | is also set. | ||
182 | .It Dv SMIME_BINARY | ||
183 | If specified, this flag is passed through to | ||
184 | .Xr SMIME_crlf_copy 3 . | ||
185 | .It Dv SMIME_CRLFEOL | ||
186 | End MIME header lines with pairs of carriage return and newline characters. | ||
187 | By default, no carriage return characters are written | ||
188 | and header lines are ended with newline characters only. | ||
189 | .It Dv SMIME_OLDMIME | ||
190 | If this bit is set in the | ||
142 | .Fa flags | 191 | .Fa flags |
143 | argument, | 192 | argument, |
144 | .Qq application/pkcs7-mime | 193 | .Qq application/pkcs7-mime |
@@ -150,35 +199,30 @@ Otherwise, | |||
150 | or | 199 | or |
151 | .Qq application/x-pkcs7-signature | 200 | .Qq application/x-pkcs7-signature |
152 | is used. | 201 | is used. |
153 | .Pp | 202 | .El |
154 | If cleartext signing is being used and | ||
155 | .Dv PKCS7_STREAM | ||
156 | is not set, then the data must be read twice: once to compute the | ||
157 | signature in | ||
158 | .Xr PKCS7_sign 3 | ||
159 | and once to output the S/MIME message. | ||
160 | .Pp | ||
161 | If streaming is performed, the content is output in BER format using | ||
162 | indefinite length constructed encoding except in the case of signed | ||
163 | data with detached content where the content is absent and DER | ||
164 | format is used. | ||
165 | .Sh RETURN VALUES | 203 | .Sh RETURN VALUES |
166 | Upon successful completion, 1 is returned; | 204 | .Fn SMIME_write_PKCS7 |
167 | otherwise 0 is returned and an error code can be retrieved with | 205 | is intended to return 1 on success or 0 on failure. |
168 | .Xr ERR_get_error 3 . | ||
169 | .Sh SEE ALSO | 206 | .Sh SEE ALSO |
207 | .Xr BIO_f_base64 3 , | ||
208 | .Xr BIO_new 3 , | ||
170 | .Xr i2d_PKCS7_bio_stream 3 , | 209 | .Xr i2d_PKCS7_bio_stream 3 , |
171 | .Xr PEM_write_bio_PKCS7_stream 3 , | 210 | .Xr PEM_write_bio_PKCS7_stream 3 , |
172 | .Xr PEM_write_PKCS7 3 , | 211 | .Xr PEM_write_PKCS7 3 , |
173 | .Xr PKCS7_final 3 , | 212 | .Xr PKCS7_final 3 , |
174 | .Xr PKCS7_new 3 , | 213 | .Xr PKCS7_new 3 , |
214 | .Xr SMIME_crlf_copy 3 , | ||
175 | .Xr SMIME_read_PKCS7 3 , | 215 | .Xr SMIME_read_PKCS7 3 , |
176 | .Xr SMIME_write_ASN1 3 | 216 | .Xr SMIME_write_CMS 3 |
177 | .Sh HISTORY | 217 | .Sh HISTORY |
178 | .Fn SMIME_write_PKCS7 | 218 | .Fn SMIME_write_PKCS7 |
179 | first appeared in OpenSSL 0.9.5 and has been available since | 219 | first appeared in OpenSSL 0.9.5 and has been available since |
180 | .Ox 2.7 . | 220 | .Ox 2.7 . |
181 | .Sh BUGS | 221 | .Sh BUGS |
182 | .Fn SMIME_write_PKCS7 | 222 | .Fn SMIME_write_PKCS7 |
223 | ignores most errors and is likely to return 1 | ||
224 | even after producing corrupt or incomplete output. | ||
225 | .Pp | ||
226 | .Fn SMIME_write_PKCS7 | ||
183 | always base64 encodes PKCS#7 structures. | 227 | always base64 encodes PKCS#7 structures. |
184 | There should be an option to disable this. | 228 | There should be an option to disable this. |