1SMIME_WRITE_PKCS7(3) OpenSSL SMIME_WRITE_PKCS7(3)
2
3
4
6 SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format
7
9 #include <openssl/pkcs7.h>
10
11 int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags);
12
14 SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7
15 structure to produce an S/MIME message.
16
17 out is the BIO to write the data to. p7 is the appropriate PKCS7
18 structure. If streaming is enabled then the content must be supplied in
19 the data argument. flags is an optional set of flags.
20
22 The following flags can be passed in the flags parameter.
23
24 If PKCS7_DETACHED is set then cleartext signing will be used, this
25 option only makes sense for signedData where PKCS7_DETACHED is also set
26 when PKCS7_sign() is also called.
27
28 If the PKCS7_TEXT flag is set MIME headers for type text/plain are
29 added to the content, this only makes sense if PKCS7_DETACHED is also
30 set.
31
32 If the PKCS7_STREAM flag is set streaming is performed. This flag
33 should only be set if PKCS7_STREAM was also set in the previous call to
34 PKCS7_sign() or PKCS7_encrypt().
35
36 If cleartext signing is being used and PKCS7_STREAM not set then the
37 data must be read twice: once to compute the signature in PKCS7_sign()
38 and once to output the S/MIME message.
39
40 If streaming is performed the content is output in BER format using
41 indefinite length constructed encoding except in the case of signed
42 data with detached content where the content is absent and DER format
43 is used.
44
46 SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there
47 should be an option to disable this.
48
50 SMIME_write_PKCS7() returns 1 for success or 0 for failure.
51
53 ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3)
54 PKCS7_decrypt(3)
55
57 Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
58
59 Licensed under the OpenSSL license (the "License"). You may not use
60 this file except in compliance with the License. You can obtain a copy
61 in the file LICENSE in the source distribution or at
62 <https://www.openssl.org/source/license.html>.
63
64
65
661.1.1g 2020-04-23 SMIME_WRITE_PKCS7(3)