int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
	{
	switch (ri->type)
		{
		case CMS_RECIPINFO_TRANS:
		return cms_RecipientInfo_ktri_encrypt(cms, ri);

		case CMS_RECIPINFO_AGREE:
		return cms_RecipientInfo_kari_encrypt(cms, ri);

		case CMS_RECIPINFO_KEK:
		return cms_RecipientInfo_kekri_encrypt(cms, ri);
		break;

		case CMS_RECIPINFO_PASS:
		return cms_RecipientInfo_pwri_crypt(cms, ri, 1);
		break;

		default:
		CMSerr(CMS_F_CMS_RECIPIENTINFO_ENCRYPT,
				CMS_R_UNSUPPORTED_RECIPIENT_TYPE);
		return 0;
		}
	}