char inbuf[4096];
PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,								int flags){	PKCS7 *p7;	BIO *p7bio = NULL;	int i;	X509 *x509;	char inbuf[4096];	static char txthdr[] = "Content-type: text/plain\r\n\r\n";	if(!(p7 = PKCS7_new())) {		PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE);		return NULL;	}	PKCS7_set_type(p7, NID_pkcs7_enveloped);	if(!PKCS7_set_cipher(p7, cipher)) {		PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER);		goto err;	}	for(i = 0; i < sk_X509_num(certs); i++) {		x509 = sk_X509_value(certs, i);		if(!PKCS7_add_recipient(p7, x509)) {			PKCS7err(PKCS7_F_PKCS7_ENCRYPT,					PKCS7_R_ERROR_ADDING_RECIPIENT);			goto err;		}	}	if(!(p7bio = PKCS7_dataInit(p7, NULL))) {		PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE);		goto err;	}	if(flags & PKCS7_TEXT) {		if(BIO_write(p7bio, txthdr, sizeof(txthdr) - 1) < 0) {			goto err;		}	}	SMIME_crlf_copy(in, p7bio, flags);	BIO_flush(p7bio);        if (!PKCS7_dataFinal(p7,p7bio)) {		PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR);		goto err;	}        BIO_free_all(p7bio);	return p7;	err:	BIO_free(p7bio);	PKCS7_free(p7);	return NULL;}