summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/SMIME_write_PKCS7.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/SMIME_write_PKCS7.3')
-rw-r--r--src/lib/libcrypto/man/SMIME_write_PKCS7.3135
1 files changed, 86 insertions, 49 deletions
diff --git a/src/lib/libcrypto/man/SMIME_write_PKCS7.3 b/src/lib/libcrypto/man/SMIME_write_PKCS7.3
index 72200c0b1b..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.11 2025/06/11 14:23:14 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
@@ -84,48 +84,81 @@
84.Fc 84.Fc
85.Sh DESCRIPTION 85.Sh DESCRIPTION
86.Fn SMIME_write_PKCS7 86.Fn SMIME_write_PKCS7
87adds the appropriate MIME headers to a PKCS#7 structure to produce an 87generates an S/MIME message on
88S/MIME message.
89.Pp
90.Fa out 88.Fa out
91is the 89by writing MIME 1.0 headers
92.Vt BIO 90followed by a BER- and base64-encoded serialization of
93to write the data to. 91.Fa p7 .
94.Fa p7 92The BER encoding uses the DER format except as described for
95is the appropriate 93.Dv PKCS7_STREAM
96.Vt PKCS7 94below.
97structure.
98If streaming is enabled, then the content must be supplied in the 95If streaming is enabled, then the content must be supplied in the
99.Fa data 96.Fa data
100argument. 97argument.
101.Fa flags
102is an optional set of flags.
103.Pp 98.Pp
104The following flags can be passed in the 99The
105.Fa flags 100.Fa flags
106parameter. 101can be the logical OR of zero or more of the following bits:
107.Pp 102.Bl -tag -width Ds
103.It Dv PKCS7_DETACHED
104Use cleartext signing and generate a
105.Qq multipart/signed
106S/MIME message.
107The content is read from
108.Fa data .
108If 109If
109.Dv PKCS7_DETACHED 110.Fa data
110is set, then cleartext signing will be used. 111is a
111This option only makes sense for signedData where 112.Dv NULL
113pointer, this flag is ignored.
114.Pp
115This flag is only supported for signedData where
112.Dv PKCS7_DETACHED 116.Dv PKCS7_DETACHED
113is also set when 117is also set when
114.Xr PKCS7_sign 3 118.Xr PKCS7_sign 3
115is also called. 119is called.
116.Pp 120.Pp
117If the 121If
118.Dv PKCS7_TEXT 122.Dv PKCS7_STREAM
119flag is set, MIME headers for type 123is not set, the data must be read twice: once to compute the
120.Sy text/plain 124signature in
121are added to the content. 125.Xr PKCS7_sign 3
122This only makes sense if 126and once to output the S/MIME message.
127.Pp
128If
129.Dv PKCS7_DETACHED
130is 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
138if
139.Fa p7
140specifies any digest algorithm
141.It Qq certs-only
142otherwise
143.El
144.It Dv NID_id_smime_ct_compressedData
145.Qq compressed-data
146.El
147.It Dv PKCS7_REUSE_DIGEST
148Skip the calls to
149.Xr PKCS7_dataInit 3
150and
151.Xr PKCS7_dataFinal 3 .
152This flag has no effect unless
123.Dv PKCS7_DETACHED 153.Dv PKCS7_DETACHED
124is also set. 154is also set.
155.It Dv PKCS7_STREAM
156Perform streaming by reading the content from
157.Fa data .
158This only works if
159.Dv PKCS7_DETACHED
160is not specified.
125.Pp 161.Pp
126If the
127.Dv PKCS7_STREAM
128flag is set, streaming is performed.
129This flag should only be set if 162This flag should only be set if
130.Dv PKCS7_STREAM 163.Dv PKCS7_STREAM
131was also set in the previous call to 164was also set in the previous call to
@@ -133,13 +166,28 @@ was also set in the previous call to
133or 166or
134.Xr PKCS7_encrypt 3 . 167.Xr PKCS7_encrypt 3 .
135.Pp 168.Pp
136The bit 169The content is output in BER format using indefinite length constructed
137.Dv SMIME_OLDMIME 170encoding except in the case of signed data with detached content
138is inverted before passing on the 171where the content is absent and DER format is used.
139.Fa flags 172.It Dv PKCS7_TEXT
140to 173Prepend the line
141.Xr SMIME_write_ASN1 3 . 174.Qq Content-Type: text/plain
142Consequently, if this bit is set in the 175to the content.
176This only makes sense if
177.Dv PKCS7_DETACHED
178is also set.
179It is ignored if the flag
180.Dv SMIME_BINARY
181is also set.
182.It Dv SMIME_BINARY
183If specified, this flag is passed through to
184.Xr SMIME_crlf_copy 3 .
185.It Dv SMIME_CRLFEOL
186End MIME header lines with pairs of carriage return and newline characters.
187By default, no carriage return characters are written
188and header lines are ended with newline characters only.
189.It Dv SMIME_OLDMIME
190If this bit is set in the
143.Fa flags 191.Fa flags
144argument, 192argument,
145.Qq application/pkcs7-mime 193.Qq application/pkcs7-mime
@@ -151,18 +199,7 @@ Otherwise,
151or 199or
152.Qq application/x-pkcs7-signature 200.Qq application/x-pkcs7-signature
153is used. 201is used.
154.Pp 202.El
155If cleartext signing is being used and
156.Dv PKCS7_STREAM
157is not set, then the data must be read twice: once to compute the
158signature in
159.Xr PKCS7_sign 3
160and once to output the S/MIME message.
161.Pp
162If streaming is performed, the content is output in BER format using
163indefinite length constructed encoding except in the case of signed
164data with detached content where the content is absent and DER
165format is used.
166.Sh RETURN VALUES 203.Sh RETURN VALUES
167.Fn SMIME_write_PKCS7 204.Fn SMIME_write_PKCS7
168is intended to return 1 on success or 0 on failure. 205is intended to return 1 on success or 0 on failure.