NAME
SMIMEwritePKCS7 - convert PKCS#7 structure to S/MIME format.
SYNOPSIS
int SMIMEwritePKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags);DESCRIPTION
SMIMEwritePKCS7() adds the appropriate MIME headers to a PKCS#7
structure to produce an S/MIME message. oouutt is the BIO to write the data to. pp77 is the appropriate PPKKCCSS77 structure. If cleartext signing (mmuullttiippaarrtt//ssiiggnneedd) is being used then the signed data must be supplied in the ddaattaa argument. ffllaaggss is an optional set of flags. NNOOTTEESS The following flags can be passed in the ffllaaggss parameter. If PPKKCCSS77DDEETTAACCHHEEDD is set then cleartext signing will be used, this option only makes sense for signedData where PPKKCCSS77DDEETTAACCHHEEDD is also set when PKCS7sign() is also called. If the PPKKCCSS77TTEEXXTT flag is set MIME headers for type tteexxtt//ppllaaiinn are added to the content, this only makes sense if PPKKCCSS77DDEETTAACCHHEEDD is also set. If cleartext signing is being used then the data must be read twice: once to compute the signature in PKCS7sign() and once to output the S/MIME message.BUGS
SMIMEwritePKCS7() always base64 encodes PKCS#7 structures, there
should be an option to disable this. There should really be a way to produce cleartext signing using only a single pass of the data.RETURN VALUES
SMIMEwritePKCS7() returns 1 for success or 0 for failure.SEE ALSO
ERRgeterror(3), PKCS7sign(3), PKCS7verify(3), PKCS7encrypt(3) PKCS7decrypt(3) HISTORY SMIMEwritePKCS7() was added to OpenSSL 0.9.50.9.7l 2002-10-18 SMIMEwritePKCS7(3)