CMS_compress(3) OpenSSL CMS_compress(3) NNAAMMEE CMS_compress - create a CMS CompressedData structure SSYYNNOOPPSSIISS #include CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); DDEESSCCRRIIPPTTIIOONN _C_M_S___c_o_m_p_r_e_s_s_(_) creates and returns a CMS CompressedData structure. ccoommpp__nniidd is the compression algorithm to use or NNIIDD__uunnddeeff to use the default algorithm (zlib compression). iinn is the content to be com- pressed. ffllaaggss is an optional set of flags. NNOOTTEESS The only currently supported compression algorithm is zlib using the NID NID_zlib_compression. If zlib support is not compiled into OpenSSL then _C_M_S___c_o_m_p_r_e_s_s_(_) will return an error. If the CCMMSS__TTEEXXTT flag is set MIME headers for type tteexxtt//ppllaaiinn are prepended to the data. Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CCMMSS__BBIINNAARRYY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If CCMMSS__BBIINNAARRYY is set then CCMMSS__TTEEXXTT is ignored. If the CCMMSS__SSTTRREEAAMM flag is set a partial CCMMSS__CCoonntteennttIInnffoo structure is returned suitable for streaming I/O: no data is read from the BIO iinn. The compressed data is included in the CMS_ContentInfo structure, unless CCMMSS__DDEETTAACCHHEEDD is set in which case it is omitted. This is rarely used in practice and is not supported by _S_M_I_M_E___w_r_i_t_e___C_M_S_(_). NNOOTTEESS If the flag CCMMSS__SSTTRREEAAMM is set the returned CCMMSS__CCoonntteennttIInnffoo structure is nnoott complete and outputting its contents via a function that does not properly finalize the CCMMSS__CCoonntteennttIInnffoo structure will give unpredictable results. Several functions including _S_M_I_M_E___w_r_i_t_e___C_M_S_(_), _i_2_d___C_M_S___b_i_o___s_t_r_e_a_m_(_), _P_E_M___w_r_i_t_e___b_i_o___C_M_S___s_t_r_e_a_m_(_) finalize the structure. Alternatively final- ization can be performed by obtaining the streaming ASN1 BBIIOO directly using _B_I_O___n_e_w___C_M_S_(_). Additional compression parameters such as the zlib compression level cannot currently be set. RREETTUURRNN VVAALLUUEESS _C_M_S___c_o_m_p_r_e_s_s_(_) returns either a CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from _E_R_R___g_e_t___e_r_r_o_r(3). SSEEEE AALLSSOO _E_R_R___g_e_t___e_r_r_o_r(3), _C_M_S___u_n_c_o_m_p_r_e_s_s(3) HHIISSTTOORRYY _C_M_S___c_o_m_p_r_e_s_s_(_) was added to OpenSSL 0.9.8 The CCMMSS__SSTTRREEAAMM flag was first supported in OpenSSL 1.0.0. 1.0.1u 2016-09-22 CMS_compress(3)