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