PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128); PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64);
PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,							BIO *data, int flags){	PKCS7 *p7;	PKCS7_SIGNER_INFO *si;	BIO *p7bio;	STACK *smcap;	int i;	if(!X509_check_private_key(signcert, pkey)) {		PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE);                return NULL;	}	if(!(p7 = PKCS7_new())) {		PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);		return NULL;	}	PKCS7_set_type(p7, NID_pkcs7_signed);	PKCS7_content_new(p7, NID_pkcs7_data);    	if (!(si = PKCS7_add_signature(p7,signcert,pkey,EVP_sha1()))) {		PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR);		return NULL;	}	if(!(flags & PKCS7_NOCERTS)) {		PKCS7_add_certificate(p7, signcert);		if(certs) for(i = 0; i < sk_X509_num(certs); i++)			PKCS7_add_certificate(p7, sk_X509_value(certs, i));	}	if(!(p7bio = PKCS7_dataInit(p7, NULL))) {		PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);		return NULL;	}	SMIME_crlf_copy(data, p7bio, flags);	if(!(flags & PKCS7_NOATTR)) {		PKCS7_add_signed_attribute(si, NID_pkcs9_contentType,				V_ASN1_OBJECT, OBJ_nid2obj(NID_pkcs7_data));		/* Add SMIMECapabilities */		if(!(smcap = sk_new(NULL))) {			PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);			return NULL;		}#ifndef NO_DES		PKCS7_simple_smimecap (smcap, NID_des_ede3_cbc, -1);		PKCS7_simple_smimecap (smcap, NID_des_cbc, -1);#endif#ifndef NO_RC2		PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40);		PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128);		PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64);#endif		PKCS7_add_attrib_smimecap (si, smcap);		sk_pop_free(smcap, X509_ALGOR_free);	}	if(flags & PKCS7_DETACHED)PKCS7_set_detached(p7, 1);        if (!PKCS7_dataFinal(p7,p7bio)) {		PKCS7err(PKCS7_F_PKCS7_SIGN,PKCS7_R_PKCS7_DATASIGN);		return NULL;	}        BIO_free_all(p7bio);	return p7;}