SMIME_write_PKCS7(3) OpenSSL SMIME_write_PKCS7(3) NNAAMMEE SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format. SSYYNNOOPPSSIISS #include int SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags); DDEESSCCRRIIPPTTIIOONN _S_M_I_M_E___w_r_i_t_e___P_K_C_S_7_(_) 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 struc- ture. If streaming is enabled then the content 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 PPKKCCSS77__DDEETTAACCHHEEDD is set then cleartext signing will be used, this option only makes sense for signedData where PPKKCCSS77__DDEETTAACCHHEEDD is also set when _P_K_C_S_7___s_i_g_n_(_) is also called. If the PPKKCCSS77__TTEEXXTT flag is set MIME headers for type tteexxtt//ppllaaiinn are added to the content, this only makes sense if PPKKCCSS77__DDEETTAACCHHEEDD is also set. If the PPKKCCSS77__SSTTRREEAAMM flag is set streaming is performed. This flag should only be set if PPKKCCSS77__SSTTRREEAAMM was also set in the previous call to _P_K_C_S_7___s_i_g_n_(_) or _PP_KK_CC_SS_77____ee_nn_cc_rr_yy_pp_tt_((_)). If cleartext signing is being used and PPKKCCSS77__SSTTRREEAAMM not set then the data must be read twice: once to compute the signature in _P_K_C_S_7___s_i_g_n_(_) and once to output the S/MIME message. If streaming is performed the content is output in BER format using indefinite length constructuted encoding except in the case of signed data with detached content where the content is absent and DER format is used. BBUUGGSS _S_M_I_M_E___w_r_i_t_e___P_K_C_S_7_(_) always base64 encodes PKCS#7 structures, there should be an option to disable this. RREETTUURRNN VVAALLUUEESS _S_M_I_M_E___w_r_i_t_e___P_K_C_S_7_(_) returns 1 for success or 0 for failure. SSEEEE AALLSSOO _E_R_R___g_e_t___e_r_r_o_r(3), _P_K_C_S_7___s_i_g_n(3), _P_K_C_S_7___v_e_r_i_f_y(3), _P_K_C_S_7___e_n_c_r_y_p_t(3) _P_K_C_S_7___d_e_c_r_y_p_t(3) HHIISSTTOORRYY _S_M_I_M_E___w_r_i_t_e___P_K_C_S_7_(_) was added to OpenSSL 0.9.5 1.0.2u 2019-12-20 SMIME_write_PKCS7(3)