ASN1_INTEGER_set (p7->d.encrypted->version, 0); p7->d.encrypted->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data);
PKCS7 *PKCS12_pack_p7encdata (int pbe_nid, const char *pass, int passlen,	     unsigned char *salt, int saltlen, int iter, STACK *bags){	PKCS7 *p7;	X509_ALGOR *pbe;	if (!(p7 = PKCS7_new())) {		PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);		return NULL;	}	p7->type = OBJ_nid2obj(NID_pkcs7_encrypted);	if (!(p7->d.encrypted = PKCS7_ENCRYPT_new ())) {		PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);		return NULL;	}	ASN1_INTEGER_set (p7->d.encrypted->version, 0);	p7->d.encrypted->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data);	if (!(pbe = PKCS5_pbe_set (pbe_nid, iter, salt, saltlen))) {		PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);		return NULL;	}	X509_ALGOR_free(p7->d.encrypted->enc_data->algorithm);	p7->d.encrypted->enc_data->algorithm = pbe;	ASN1_OCTET_STRING_free(p7->d.encrypted->enc_data->enc_data);	if (!(p7->d.encrypted->enc_data->enc_data =	PKCS12_i2d_encrypt (pbe, i2d_PKCS12_SAFEBAG, pass, passlen,				 (char *)bags, 1))) {		PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, PKCS12_R_ENCRYPT_ERROR);		return NULL;	}	return p7;}