refactor denomination key structs to allow proper signing / serialization with new variable-size RSA keys
This commit is contained in:
parent
7673ca0137
commit
4d98a1200a
@ -442,8 +442,11 @@ struct TALER_MINT_DenomKeyIssue
|
|||||||
*/
|
*/
|
||||||
struct TALER_AmountNBO fee_refresh;
|
struct TALER_AmountNBO fee_refresh;
|
||||||
|
|
||||||
// FIXME: does not work like this:
|
/**
|
||||||
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
|
* Hash code of the denomination public key.
|
||||||
|
*/
|
||||||
|
struct GNUNET_HashCode denom_hash;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GNUNET_NETWORK_STRUCT_END
|
GNUNET_NETWORK_STRUCT_END
|
||||||
|
@ -60,6 +60,7 @@ struct TALER_MINT_SignKeyIssuePriv
|
|||||||
struct TALER_MINT_SignKeyIssue issue;
|
struct TALER_MINT_SignKeyIssue issue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GNUNET_NETWORK_STRUCT_END
|
GNUNET_NETWORK_STRUCT_END
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +78,13 @@ struct TALER_MINT_DenomKeyIssuePriv
|
|||||||
struct GNUNET_CRYPTO_rsa_PrivateKey *denom_priv;
|
struct GNUNET_CRYPTO_rsa_PrivateKey *denom_priv;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public information about a denomination key.
|
* Decoded denomination public key (the hash of it is in
|
||||||
|
* @e issue, but we sometimes need the full public key as well).
|
||||||
|
*/
|
||||||
|
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signed public information about a denomination key.
|
||||||
*/
|
*/
|
||||||
struct TALER_MINT_DenomKeyIssue issue;
|
struct TALER_MINT_DenomKeyIssue issue;
|
||||||
};
|
};
|
||||||
|
@ -106,11 +106,13 @@ static int reload_pipe[2];
|
|||||||
* Convert the public part of a denomination key issue to a JSON
|
* Convert the public part of a denomination key issue to a JSON
|
||||||
* object.
|
* object.
|
||||||
*
|
*
|
||||||
|
* @param pk public key of the denomination key
|
||||||
* @param dki the denomination key issue
|
* @param dki the denomination key issue
|
||||||
* @return a JSON object describing the denomination key isue (public part)
|
* @return a JSON object describing the denomination key isue (public part)
|
||||||
*/
|
*/
|
||||||
static json_t *
|
static json_t *
|
||||||
denom_key_issue_to_json (const struct TALER_MINT_DenomKeyIssue *dki)
|
denom_key_issue_to_json (struct GNUNET_CRYPTO_rsa_PublicKey *pk,
|
||||||
|
const struct TALER_MINT_DenomKeyIssue *dki)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
|
json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
|
||||||
@ -124,7 +126,7 @@ denom_key_issue_to_json (const struct TALER_MINT_DenomKeyIssue *dki)
|
|||||||
"stamp_expire_deposit",
|
"stamp_expire_deposit",
|
||||||
TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_spend)),
|
TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_spend)),
|
||||||
"denom_pub",
|
"denom_pub",
|
||||||
TALER_JSON_from_rsa_public_key (dki->denom_pub),
|
TALER_JSON_from_rsa_public_key (pk),
|
||||||
"value",
|
"value",
|
||||||
TALER_JSON_from_amount (TALER_amount_ntoh (dki->value)),
|
TALER_JSON_from_amount (TALER_amount_ntoh (dki->value)),
|
||||||
"fee_withdraw",
|
"fee_withdraw",
|
||||||
@ -202,9 +204,8 @@ reload_keys_denom_iter (void *cls,
|
|||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_CRYPTO_hash (&dki->issue.denom_pub,
|
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub,
|
||||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey),
|
&denom_key_hash);
|
||||||
&denom_key_hash);
|
|
||||||
d2 = GNUNET_memdup (dki,
|
d2 = GNUNET_memdup (dki,
|
||||||
sizeof (struct TALER_MINT_DenomKeyIssuePriv));
|
sizeof (struct TALER_MINT_DenomKeyIssuePriv));
|
||||||
res = GNUNET_CONTAINER_multihashmap_put (ctx->denomkey_map,
|
res = GNUNET_CONTAINER_multihashmap_put (ctx->denomkey_map,
|
||||||
@ -220,7 +221,8 @@ reload_keys_denom_iter (void *cls,
|
|||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
json_array_append_new (ctx->denom_keys_array,
|
json_array_append_new (ctx->denom_keys_array,
|
||||||
denom_key_issue_to_json (&dki->issue));
|
denom_key_issue_to_json (dki->denom_pub,
|
||||||
|
&dki->issue));
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,9 @@ create_denomkey_issue (struct CoinTypeParams *params,
|
|||||||
struct TALER_MINT_DenomKeyIssuePriv *dki)
|
struct TALER_MINT_DenomKeyIssuePriv *dki)
|
||||||
{
|
{
|
||||||
GNUNET_assert (NULL != (dki->denom_priv = GNUNET_CRYPTO_rsa_private_key_create (RSA_KEYSIZE)));
|
GNUNET_assert (NULL != (dki->denom_priv = GNUNET_CRYPTO_rsa_private_key_create (RSA_KEYSIZE)));
|
||||||
dki->issue.denom_pub = GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv);
|
dki->denom_pub = GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv);
|
||||||
|
GNUNET_CRYPTO_rsa_public_key_hash (dki->denom_pub,
|
||||||
|
&dki->issue.denom_hash);
|
||||||
dki->issue.master = *master_pub;
|
dki->issue.master = *master_pub;
|
||||||
dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor);
|
dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor);
|
||||||
dki->issue.expire_withdraw =
|
dki->issue.expire_withdraw =
|
||||||
|
Loading…
Reference in New Issue
Block a user