61945b388728e9ac3516f3557cde4b4ab14751d7
[openssl.git] / doc / crypto / SMIME_write_PKCS7.pod
1 =pod
2
3 =head1 NAME
4
5 SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format.
6
7 =head1 SYNOPSIS
8
9 int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags);
10
11 =head1 DESCRIPTION
12
13 SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7
14 structure to produce an S/MIME message.
15
16 B<out> is the BIO to write the data to. B<p7> is the appropriate
17 B<PKCS7> structure. If cleartext signing (B<multipart/signed>) is
18 being used then the signed data must be supplied in the B<data> 
19 argument. B<flags> is an optional set of flags.
20
21 =head1 NOTES
22
23 The following flags can be passed in the B<flags> parameter.
24
25 If B<PKCS7_DETACHED> is set then cleartext signing will be used,
26 this option only makes sense for signedData where B<PKCS7_DETACHED>
27 is also set when PKCS7_sign() is also called.
28
29 If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain>
30 are added to the content, this only makes sense if B<PKCS7_DETACHED>
31 is also set.
32
33 If the B<PKCS7_PARTSIGN> flag is set the signed data is finalized
34 and output along with the content. This flag should only be set
35 if B<PKCS7_DETACHED> is also set and the previous call to PKCS7_sign()
36 also set these flags.
37
38 If cleartext signing is being used and B<PKCS7_PARTSIGN> not set then
39 the data must be read twice: once to compute the signature in PKCS7_sign()
40 and once to output the S/MIME message.
41
42 =head1 BUGS
43
44 SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there
45 should be an option to disable this.
46
47 =head1 RETURN VALUES
48
49 SMIME_write_PKCS7() returns 1 for success or 0 for failure.
50
51 =head1 SEE ALSO
52
53 L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
54 L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
55 L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>
56
57 =head1 HISTORY
58
59 SMIME_write_PKCS7() was added to OpenSSL 0.9.5
60
61 =cut