int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt,
				   gnutls_datum_t * m, gnutls_datum_t * e)
{
    int ret;
    mpi_t params[MAX_PUBLIC_PARAMS_SIZE];
    int params_size = MAX_PUBLIC_PARAMS_SIZE;
    int i;

    if (crt == NULL) {
	gnutls_assert();
	return GNUTLS_E_INVALID_REQUEST;
    }

    ret = gnutls_x509_crt_get_pk_algorithm(crt, NULL);
    if (ret != GNUTLS_PK_RSA) {
	gnutls_assert();
	return GNUTLS_E_INVALID_REQUEST;
    }

    ret = _gnutls_x509_crt_get_mpis(crt, params, &params_size);
    if (ret < 0) {
	gnutls_assert();
	return ret;
    }

    ret = _gnutls_mpi_dprint(m, params[0]);
    if (ret < 0) {
	gnutls_assert();
	goto cleanup;
    }

    ret = _gnutls_mpi_dprint(e, params[1]);
    if (ret < 0) {
	gnutls_assert();
	_gnutls_free_datum(m);
	goto cleanup;
    }

    ret = 0;

  cleanup:
    for (i = 0; i < params_size; i++) {
	_gnutls_mpi_release(&params[i]);
    }
    return ret;
}
int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt,
				   gnutls_datum_t * m, gnutls_datum_t * e)
{
    int ret;
    mpi_t params[MAX_PUBLIC_PARAMS_SIZE];
    int params_size = MAX_PUBLIC_PARAMS_SIZE;
    int i;

    if (crt == NULL) {
	gnutls_assert();
	return GNUTLS_E_INVALID_REQUEST;
    }

    ret = gnutls_x509_crt_get_pk_algorithm(crt, NULL);
    if (ret != GNUTLS_PK_RSA) {
	gnutls_assert();
	return GNUTLS_E_INVALID_REQUEST;
    }

    ret = _gnutls_x509_crt_get_mpis(crt, params, &params_size);
    if (ret < 0) {
	gnutls_assert();
	return ret;
    }

    ret = _gnutls_mpi_dprint(m, params[0]);
    if (ret < 0) {
	gnutls_assert();
	goto cleanup;
    }

    ret = _gnutls_mpi_dprint(e, params[1]);
    if (ret < 0) {
	gnutls_assert();
	_gnutls_free_datum(m);
	goto cleanup;
    }

    ret = 0;

  cleanup:
    for (i = 0; i < params_size; i++) {
	_gnutls_mpi_release(&params[i]);
    }
    return ret;
}