/** * gnutls_rsa_params_import_raw - This function will replace the old RSA parameters * @rsa_params: Is a structure will hold the parameters * @m: holds the modulus * @e: holds the public exponent * @d: holds the private exponent * @p: holds the first prime (p) * @q: holds the second prime (q) * @u: holds the coefficient * * This function will replace the parameters in the given structure. * The new parameters should be stored in the appropriate gnutls_datum. * **/ int gnutls_rsa_params_import_raw (gnutls_rsa_params_t rsa_params, const gnutls_datum_t * m, const gnutls_datum_t * e, const gnutls_datum_t * d, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * u) { return gnutls_x509_privkey_import_rsa_raw (rsa_params, m, e, d, p, q, u); }
static int rsa_params_to_pem(const legacy_privkey_t *params, dnssec_binary_t *pem) { _cleanup_x509_privkey_ gnutls_x509_privkey_t key = NULL; int result = gnutls_x509_privkey_init(&key); if (result != GNUTLS_E_SUCCESS) { return DNSSEC_ENOMEM; } gnutls_datum_t m = binary_to_datum(¶ms->modulus); gnutls_datum_t e = binary_to_datum(¶ms->public_exponent); gnutls_datum_t d = binary_to_datum(¶ms->private_exponent); gnutls_datum_t p = binary_to_datum(¶ms->prime_one); gnutls_datum_t q = binary_to_datum(¶ms->prime_two); gnutls_datum_t u = binary_to_datum(¶ms->coefficient); result = gnutls_x509_privkey_import_rsa_raw(key, &m, &e, &d, &p, &q, &u); if (result != GNUTLS_E_SUCCESS) { return DNSSEC_KEY_IMPORT_ERROR; } return pem_from_x509(key, pem); }