PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509)
	{
	PKCS7_RECIP_INFO *ri;

	if ((ri=PKCS7_RECIP_INFO_new()) == NULL) goto err;
	if (!PKCS7_RECIP_INFO_set(ri,x509)) goto err;
	if (!PKCS7_add_recipient_info(p7,ri)) goto err;
	return(ri);
err:
	return(NULL);
	}
static VALUE
ossl_pkcs7_add_recipient(VALUE self, VALUE recip)
{
    PKCS7 *pkcs7;
    PKCS7_RECIP_INFO *ri;

    ri = DupPKCS7RecipientPtr(recip); /* NEED TO DUP */
    GetPKCS7(self, pkcs7);
    if (!PKCS7_add_recipient_info(pkcs7, ri)) {
	PKCS7_RECIP_INFO_free(ri);
	ossl_raise(ePKCS7Error, "Could not add recipient.");
    }

    return self;
}