예제 #1
0
/**
 * gnutls_openpgp_privkey_export_subkey_dsa_raw:
 * @pkey: Holds the certificate
 * @idx: Is the subkey index
 * @p: will hold the p
 * @q: will hold the q
 * @g: will hold the g
 * @y: will hold the y
 * @x: will hold the x
 *
 * This function will export the DSA private key's parameters found
 * in the given certificate.  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_dsa_raw(gnutls_openpgp_privkey_t pkey,
					     unsigned int idx,
					     gnutls_datum_t * p,
					     gnutls_datum_t * q,
					     gnutls_datum_t * g,
					     gnutls_datum_t * y,
					     gnutls_datum_t * x)
{
	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_dsa_raw(pkey, keyid, p, q, g, y, x);
}
예제 #2
0
/**
 * gnutls_openpgp_privkey_export_dsa_raw:
 * @pkey: Holds the certificate
 * @p: will hold the p
 * @q: will hold the q
 * @g: will hold the g
 * @y: will hold the y
 * @x: will hold the x
 *
 * This function will export the DSA private key's parameters found in
 * the given certificate.  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_dsa_raw (gnutls_openpgp_privkey_t pkey,
				       gnutls_datum_t * p, gnutls_datum_t * q,
				       gnutls_datum_t * g, gnutls_datum_t * y,
				       gnutls_datum_t * x)
{
  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_dsa_raw (pkey, keyid, p, q, g, y, x);
}
예제 #3
0
파일: privkey.c 프로젝트: nobled/gnutls
/**
 * gnutls_openpgp_privkey_export_dsa_raw:
 * @pkey: Holds the certificate
 * @p: will hold the p
 * @q: will hold the q
 * @g: will hold the g
 * @y: will hold the y
 * @x: will hold the x
 *
 * This function will export the DSA private key's parameters found in
 * the given certificate.  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_dsa_raw (gnutls_openpgp_privkey_t pkey,
                                       gnutls_datum_t * p, gnutls_datum_t * q,
                                       gnutls_datum_t * g, gnutls_datum_t * y,
                                       gnutls_datum_t * x)
{
  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_dsa_raw (pkey, keyid, p, q, g, y, x);
}