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