CMS_get0_RecipientInfos(3) OpenSSL CMS_get0_RecipientInfos(3) NNAAMMEE CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt - CMS envelopedData RecipientInfo routines SSYYNNOOPPSSIISS #include STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT **potherid, ASN1_TYPE **pothertype); int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned char *id, size_t idlen); int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, size_t keylen); int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); DDEESSCCRRIIPPTTIIOONN The function _C_M_S___g_e_t_0___R_e_c_i_p_i_e_n_t_I_n_f_o_s_(_) returns all the CMS_Recipi- entInfo structures associated with a CMS EnvelopedData structure. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___t_y_p_e_(_) returns the type of CMS_RecipientInfo struc- ture rrii. It will currently return CMS_RECIPINFO_TRANS, CMS_RECIP- INFO_AGREE, CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIP- INFO_OTHER. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_t_r_i___g_e_t_0___s_i_g_n_e_r___i_d_(_) retrieves the certificate recipient identifier associated with a specific CMS_RecipientInfo structure rrii, which must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set in kkeeyyiidd or bbootthh issuer name and serial num- ber in iissssuueerr and ssnnoo. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_t_r_i___c_e_r_t___c_m_p_(_) compares the certificate cceerrtt against the CMS_RecipientInfo structure rrii, which must be of type CMS_RECIP- INFO_TRANS. It returns zero if the comparison is successful and non zero if not. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___s_e_t_0___p_k_e_y_(_) associates the private key ppkkeeyy with the CMS_RecipientInfo structure rrii, which must be of type CMS_RECIP- INFO_TRANS. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_e_k_r_i___g_e_t_0___i_d_(_) retrieves the key information from the CMS_RecipientInfo structure rrii which must be of type CMS_RECIP- INFO_KEK. Any of the remaining parameters can be NULL if the applica- tion is not interested in the value of a field. Where a field is optional and absent NULL will be written to the corresponding parame- ter. The keyEncryptionAlgorithm field is written to ppaallgg, the kkeeyyIIddeenn-- ttiiffiieerr field is written to ppiidd, the ddaattee field if present is written to ppddaattee, if the ootthheerr field is present the components kkeeyyAAttttrrIIdd and kkeeyy-- AAttttrr are written to parameters ppootthheerriidd and ppootthheerrttyyppee. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_e_k_r_i___i_d___c_m_p_(_) compares the ID in the iidd and iiddlleenn parameters against the kkeeyyIIddeennttiiffiieerr CMS_RecipientInfo structure rrii, which must be of type CMS_RECIPINFO_KEK. It returns zero if the com- parison is successful and non zero if not. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___s_e_t_0___k_e_y_(_) associates the symmetric key kkeeyy of length kkeeyylleenn with the CMS_RecipientInfo structure rrii, which must be of type CMS_RECIPINFO_KEK. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___d_e_c_r_y_p_t_(_) attempts to decrypt CMS_RecipientInfo structure rrii in structure ccmmss. A key must have been associated with the structure first. NNOOTTEESS The main purpose of these functions is to enable an application to lookup recipient keys using any appropriate technique when the simpler method of _C_M_S___d_e_c_r_y_p_t_(_) is not appropriate. In typical usage and application will retrieve all CMS_RecipientInfo structures using _C_M_S___g_e_t_0___R_e_c_i_p_i_e_n_t_I_n_f_o_s_(_) and check the type of each using _C_M_S___R_e_c_p_i_e_n_t_I_n_f_o___t_y_p_e_(_). Depending on the type the CMS_Recipi- entInfo structure can be ignored or its key identifier data retrieved using an appropriate function. Then if the corresponding secret or pri- vate key can be obtained by any appropriate means it can then associ- ated with the structure and _C_M_S___R_e_c_p_i_e_n_t_I_n_f_o___d_e_c_r_y_p_t_(_) called. If suc- cessful _C_M_S___d_e_c_r_y_p_t_(_) can be called with a NULL key to decrypt the enveloped content. RREETTUURRNN VVAALLUUEESS _C_M_S___g_e_t_0___R_e_c_i_p_i_e_n_t_I_n_f_o_s_(_) returns all CMS_RecipientInfo structures, or NULL if an error occurs. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_t_r_i___g_e_t_0___s_i_g_n_e_r___i_d_(_), _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___s_e_t_0___p_k_e_y_(_), _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_e_k_r_i___g_e_t_0___i_d_(_), _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___s_e_t_0___k_e_y_(_) and _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___d_e_c_r_y_p_t_(_) return 1 for success or 0 if an error occurs. _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_t_r_i___c_e_r_t___c_m_p_(_) and _C_M_S___R_e_c_i_p_i_e_n_t_I_n_f_o___k_e_k_r_i___c_m_p_(_) return 0 for a successful comparison and non zero otherwise. Any 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___d_e_c_r_y_p_t(3) HHIISSTTOORRYY These functions were first was added to OpenSSL 0.9.8 1.0.1u 2016-09-22 CMS_get0_RecipientInfos(3)