Ejemplo n.º 1
0
/**
 * gnutls_openpgp_privkey_export_subkey_rsa_raw:
 * @pkey: Holds the certificate
 * @idx: Is the subkey index
 * @m: will hold the modulus
 * @e: will hold the public exponent
 * @d: will hold the private exponent
 * @p: will hold the first prime (p)
 * @q: will hold the second prime (q)
 * @u: will hold the coefficient
 *
 * This function will export the RSA private key's parameters found in
 * the given structure.  The new parameters will be allocated using
 * gnutls_malloc() and will be stored in the appropriate datum.
 *
 * Returns: %GNUTLS_E_SUCCESS on success, otherwise a negative error code.
 *
 * Since: 2.4.0
 **/
int
gnutls_openpgp_privkey_export_subkey_rsa_raw(gnutls_openpgp_privkey_t pkey,
					     unsigned int idx,
					     gnutls_datum_t * m,
					     gnutls_datum_t * e,
					     gnutls_datum_t * d,
					     gnutls_datum_t * p,
					     gnutls_datum_t * q,
					     gnutls_datum_t * u)
{
	uint8_t keyid[GNUTLS_OPENPGP_KEYID_SIZE];
	int ret;

	if (idx == GNUTLS_OPENPGP_MASTER_KEYID_IDX)
		ret = gnutls_openpgp_privkey_get_key_id(pkey, keyid);
	else
		ret =
		    gnutls_openpgp_privkey_get_subkey_id(pkey, idx, keyid);
	if (ret < 0) {
		gnutls_assert();
		return ret;
	}

	return _get_sk_rsa_raw(pkey, keyid, m, e, d, p, q, u);
}
Ejemplo n.º 2
0
/**
 * gnutls_openpgp_privkey_export_rsa_raw:
 * @pkey: Holds the certificate
 * @m: will hold the modulus
 * @e: will hold the public exponent
 * @d: will hold the private exponent
 * @p: will hold the first prime (p)
 * @q: will hold the second prime (q)
 * @u: will hold the coefficient
 *
 * This function will export the RSA private key's parameters found in
 * the given structure.  The new parameters will be allocated using
 * gnutls_malloc() and will be stored in the appropriate datum.
 *
 * Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
 *
 * Since: 2.4.0
 **/
int
gnutls_openpgp_privkey_export_rsa_raw (gnutls_openpgp_privkey_t pkey,
				       gnutls_datum_t * m, gnutls_datum_t * e,
				       gnutls_datum_t * d, gnutls_datum_t * p,
				       gnutls_datum_t * q, gnutls_datum_t * u)
{
  gnutls_openpgp_keyid_t keyid;
  int ret;

  ret = gnutls_openpgp_privkey_get_key_id (pkey, keyid);
  if (ret < 0)
    {
      gnutls_assert ();
      return ret;
    }

  return _get_sk_rsa_raw (pkey, keyid, m, e, d, p, q, u);
}
Ejemplo n.º 3
0
/**
 * gnutls_openpgp_privkey_export_rsa_raw:
 * @pkey: Holds the certificate
 * @m: will hold the modulus
 * @e: will hold the public exponent
 * @d: will hold the private exponent
 * @p: will hold the first prime (p)
 * @q: will hold the second prime (q)
 * @u: will hold the coefficient
 *
 * This function will export the RSA private key's parameters found in
 * the given structure.  The new parameters will be allocated using
 * gnutls_malloc() and will be stored in the appropriate datum.
 *
 * Returns: %GNUTLS_E_SUCCESS on success, otherwise a negative error code.
 *
 * Since: 2.4.0
 **/
int
gnutls_openpgp_privkey_export_rsa_raw (gnutls_openpgp_privkey_t pkey,
                                       gnutls_datum_t * m, gnutls_datum_t * e,
                                       gnutls_datum_t * d, gnutls_datum_t * p,
                                       gnutls_datum_t * q, gnutls_datum_t * u)
{
  uint8_t keyid[GNUTLS_OPENPGP_KEYID_SIZE];
  int ret;

  ret = gnutls_openpgp_privkey_get_key_id (pkey, keyid);
  if (ret < 0)
    {
      gnutls_assert ();
      return ret;
    }

  return _get_sk_rsa_raw (pkey, keyid, m, e, d, p, q, u);
}