add h_denom_pub to deposit signatures

This commit is contained in:
Christian Grothoff 2020-07-08 15:46:51 +02:00
parent 1ca062fc7a
commit 97dfbec081
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
9 changed files with 72 additions and 13 deletions

View File

@ -520,6 +520,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
.purpose.size = htonl (sizeof (dr)), .purpose.size = htonl (sizeof (dr)),
.h_contract_terms = deposit.h_contract_terms, .h_contract_terms = deposit.h_contract_terms,
.h_wire = deposit.h_wire, .h_wire = deposit.h_wire,
.h_denom_pub = deposit.coin.denom_pub_hash,
.wallet_timestamp = GNUNET_TIME_absolute_hton (deposit.timestamp), .wallet_timestamp = GNUNET_TIME_absolute_hton (deposit.timestamp),
.refund_deadline = GNUNET_TIME_absolute_hton (deposit.refund_deadline), .refund_deadline = GNUNET_TIME_absolute_hton (deposit.refund_deadline),
.merchant = deposit.merchant_pub, .merchant = deposit.merchant_pub,

View File

@ -66,6 +66,7 @@ TEH_RESPONSE_compile_transaction_history (
.purpose.size = htonl (sizeof (dr)), .purpose.size = htonl (sizeof (dr)),
.h_contract_terms = deposit->h_contract_terms, .h_contract_terms = deposit->h_contract_terms,
.h_wire = deposit->h_wire, .h_wire = deposit->h_wire,
.h_denom_pub = deposit->h_denom_pub,
.wallet_timestamp = GNUNET_TIME_absolute_hton (deposit->timestamp), .wallet_timestamp = GNUNET_TIME_absolute_hton (deposit->timestamp),
.refund_deadline = GNUNET_TIME_absolute_hton ( .refund_deadline = GNUNET_TIME_absolute_hton (
deposit->refund_deadline), deposit->refund_deadline),
@ -94,7 +95,7 @@ TEH_RESPONSE_compile_transaction_history (
json_array_append_new ( json_array_append_new (
history, history,
json_pack ( json_pack (
"{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}", "{s:s, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
"type", "type",
"DEPOSIT", "DEPOSIT",
"amount", "amount",
@ -111,6 +112,8 @@ TEH_RESPONSE_compile_transaction_history (
GNUNET_JSON_from_data_auto (&deposit->h_contract_terms), GNUNET_JSON_from_data_auto (&deposit->h_contract_terms),
"h_wire", "h_wire",
GNUNET_JSON_from_data_auto (&deposit->h_wire), GNUNET_JSON_from_data_auto (&deposit->h_wire),
"h_denom_pub",
GNUNET_JSON_from_data_auto (&deposit->h_denom_pub),
"coin_sig", "coin_sig",
GNUNET_JSON_from_data_auto (&deposit->csig)))) GNUNET_JSON_from_data_auto (&deposit->csig))))
{ {
@ -151,7 +154,7 @@ TEH_RESPONSE_compile_transaction_history (
if (0 != if (0 !=
json_array_append_new ( json_array_append_new (
history, history,
json_pack ("{s:s, s:o, s:o, s:o, s:o}", json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}",
"type", "type",
"MELT", "MELT",
"amount", "amount",
@ -160,6 +163,8 @@ TEH_RESPONSE_compile_transaction_history (
TALER_JSON_from_amount (&melt->melt_fee), TALER_JSON_from_amount (&melt->melt_fee),
"rc", "rc",
GNUNET_JSON_from_data_auto (&melt->rc), GNUNET_JSON_from_data_auto (&melt->rc),
"h_denom_pub",
GNUNET_JSON_from_data_auto (&melt->h_denom_pub),
"coin_sig", "coin_sig",
GNUNET_JSON_from_data_auto (&melt->coin_sig)))) GNUNET_JSON_from_data_auto (&melt->coin_sig))))
{ {
@ -267,7 +272,7 @@ TEH_RESPONSE_compile_transaction_history (
if (0 != if (0 !=
json_array_append_new ( json_array_append_new (
history, history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
"type", "type",
"OLD-COIN-RECOUP", "OLD-COIN-RECOUP",
"amount", "amount",
@ -278,6 +283,8 @@ TEH_RESPONSE_compile_transaction_history (
GNUNET_JSON_from_data_auto (&epub), GNUNET_JSON_from_data_auto (&epub),
"coin_pub", "coin_pub",
GNUNET_JSON_from_data_auto (&pr->coin.coin_pub), GNUNET_JSON_from_data_auto (&pr->coin.coin_pub),
"h_denom_pub",
GNUNET_JSON_from_data_auto (&pr->coin.denom_pub_hash),
"timestamp", "timestamp",
GNUNET_JSON_from_time_abs (pr->timestamp)))) GNUNET_JSON_from_time_abs (pr->timestamp))))
{ {
@ -315,7 +322,7 @@ TEH_RESPONSE_compile_transaction_history (
if (0 != if (0 !=
json_array_append_new ( json_array_append_new (
history, history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
"type", "type",
"RECOUP", "RECOUP",
"amount", "amount",
@ -326,6 +333,8 @@ TEH_RESPONSE_compile_transaction_history (
GNUNET_JSON_from_data_auto (&epub), GNUNET_JSON_from_data_auto (&epub),
"reserve_pub", "reserve_pub",
GNUNET_JSON_from_data_auto (&recoup->reserve_pub), GNUNET_JSON_from_data_auto (&recoup->reserve_pub),
"h_denom_pub",
GNUNET_JSON_from_data_auto (&recoup->h_denom_pub),
"timestamp", "timestamp",
GNUNET_JSON_from_time_abs (recoup->timestamp)))) GNUNET_JSON_from_time_abs (recoup->timestamp))))
{ {
@ -369,7 +378,7 @@ TEH_RESPONSE_compile_transaction_history (
if (0 != if (0 !=
json_array_append_new ( json_array_append_new (
history, history,
json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o, s:o}",
"type", "type",
"RECOUP-REFRESH", "RECOUP-REFRESH",
"amount", "amount",
@ -380,6 +389,8 @@ TEH_RESPONSE_compile_transaction_history (
GNUNET_JSON_from_data_auto (&epub), GNUNET_JSON_from_data_auto (&epub),
"old_coin_pub", "old_coin_pub",
GNUNET_JSON_from_data_auto (&pr->old_coin_pub), GNUNET_JSON_from_data_auto (&pr->old_coin_pub),
"h_denom_pub",
GNUNET_JSON_from_data_auto (&pr->coin.denom_pub_hash),
"timestamp", "timestamp",
GNUNET_JSON_from_time_abs (pr->timestamp)))) GNUNET_JSON_from_time_abs (pr->timestamp))))
{ {

View File

@ -662,13 +662,15 @@ postgres_get_session (void *cls)
",old_coin_sig" ",old_coin_sig"
",amount_with_fee_val" ",amount_with_fee_val"
",amount_with_fee_frac" ",amount_with_fee_frac"
",kc.denom_pub_hash"
",denom.fee_refresh_val " ",denom.fee_refresh_val "
",denom.fee_refresh_frac " ",denom.fee_refresh_frac "
",melt_serial_id" ",melt_serial_id"
" FROM refresh_commitments" " FROM refresh_commitments"
" JOIN known_coins " " JOIN known_coins kc"
" ON (refresh_commitments.old_coin_pub = known_coins.coin_pub)" " ON (refresh_commitments.old_coin_pub = kc.coin_pub)"
" JOIN denominations denom USING (denom_pub_hash)" " JOIN denominations denom"
" USING (denom_pub_hash)"
" WHERE old_coin_pub=$1;", " WHERE old_coin_pub=$1;",
1), 1),
@ -953,6 +955,7 @@ postgres_get_session (void *cls)
",amount_with_fee_frac" ",amount_with_fee_frac"
",denom.fee_deposit_val" ",denom.fee_deposit_val"
",denom.fee_deposit_frac" ",denom.fee_deposit_frac"
",kc.denom_pub_hash"
",wallet_timestamp" ",wallet_timestamp"
",refund_deadline" ",refund_deadline"
",wire_deadline" ",wire_deadline"
@ -963,7 +966,7 @@ postgres_get_session (void *cls)
",coin_sig" ",coin_sig"
",deposit_serial_id" ",deposit_serial_id"
" FROM deposits" " FROM deposits"
" JOIN known_coins" " JOIN known_coins kc"
" USING (coin_pub)" " USING (coin_pub)"
" JOIN denominations denom" " JOIN denominations denom"
" USING (denom_pub_hash)" " USING (denom_pub_hash)"
@ -1296,8 +1299,8 @@ postgres_get_session (void *cls)
",coins.denom_sig" ",coins.denom_sig"
",recoup_refresh_uuid" ",recoup_refresh_uuid"
" FROM recoup_refresh" " FROM recoup_refresh"
" JOIN known_coins coins" " JOIN known_coins coins"
" USING (coin_pub)" " USING (coin_pub)"
" WHERE h_blind_ev IN" " WHERE h_blind_ev IN"
" (SELECT rrc.h_coin_ev" " (SELECT rrc.h_coin_ev"
" FROM refresh_commitments" " FROM refresh_commitments"
@ -1340,6 +1343,7 @@ postgres_get_session (void *cls)
GNUNET_PQ_make_prepare ("recoup_by_coin", GNUNET_PQ_make_prepare ("recoup_by_coin",
"SELECT" "SELECT"
" ro.reserve_pub" " ro.reserve_pub"
",coins.denom_pub_hash"
",coin_sig" ",coin_sig"
",coin_blind" ",coin_blind"
",amount_val" ",amount_val"
@ -1347,8 +1351,10 @@ postgres_get_session (void *cls)
",timestamp" ",timestamp"
",recoup_uuid" ",recoup_uuid"
" FROM recoup" " FROM recoup"
" JOIN reserves_out ro" " JOIN reserves_out ro"
" USING (h_blind_ev)" " USING (h_blind_ev)"
" JOIN known_coins coins"
" USING (coin_pub)"
" WHERE recoup.coin_pub=$1" " WHERE recoup.coin_pub=$1"
" FOR UPDATE;", " FOR UPDATE;",
1), 1),
@ -4079,6 +4085,8 @@ add_coin_deposit (void *cls,
&deposit->refund_deadline), &deposit->refund_deadline),
TALER_PQ_result_spec_absolute_time ("wire_deadline", TALER_PQ_result_spec_absolute_time ("wire_deadline",
&deposit->wire_deadline), &deposit->wire_deadline),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&deposit->h_denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("merchant_pub", GNUNET_PQ_result_spec_auto_from_type ("merchant_pub",
&deposit->merchant_pub), &deposit->merchant_pub),
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms", GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
@ -4144,6 +4152,8 @@ add_coin_melt (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("rc", GNUNET_PQ_result_spec_auto_from_type ("rc",
&melt->rc), &melt->rc),
/* oldcoin_index not needed */ /* oldcoin_index not needed */
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&melt->h_denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("old_coin_sig", GNUNET_PQ_result_spec_auto_from_type ("old_coin_sig",
&melt->coin_sig), &melt->coin_sig),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee", TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
@ -4335,6 +4345,8 @@ add_coin_recoup (void *cls,
&recoup->reserve_pub), &recoup->reserve_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig", GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&recoup->coin_sig), &recoup->coin_sig),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&recoup->h_denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_blind", GNUNET_PQ_result_spec_auto_from_type ("coin_blind",
&recoup->coin_blind), &recoup->coin_blind),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount", TALER_PQ_RESULT_SPEC_AMOUNT ("amount",

View File

@ -751,6 +751,7 @@ TALER_EXCHANGE_wire_cancel (struct TALER_EXCHANGE_WireHandle *wh);
* @param deposit_fee the deposit fee we expect to pay * @param deposit_fee the deposit fee we expect to pay
* @param h_wire hash of the merchants account details * @param h_wire hash of the merchants account details
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange) * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param h_denom_pub hash of the coin denomination's public key
* @param coin_priv coins private key * @param coin_priv coins private key
* @param wallet_timestamp timestamp when the contract was finalized, must not be too far in the future * @param wallet_timestamp timestamp when the contract was finalized, must not be too far in the future
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
@ -763,6 +764,7 @@ TALER_EXCHANGE_deposit_permission_sign (
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
const struct GNUNET_HashCode *h_contract_terms, const struct GNUNET_HashCode *h_contract_terms,
const struct GNUNET_HashCode *h_denom_pub,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct GNUNET_TIME_Absolute wallet_timestamp, struct GNUNET_TIME_Absolute wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,

View File

@ -335,6 +335,11 @@ struct TALER_EXCHANGEDB_RecoupListEntry
*/ */
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
/**
* Hash of the public denomination key used to sign the coin.
*/
struct GNUNET_HashCode h_denom_pub;
/** /**
* Public key of the reserve the coin was paid back into. * Public key of the reserve the coin was paid back into.
*/ */
@ -608,6 +613,11 @@ struct TALER_EXCHANGEDB_DepositListEntry
*/ */
struct GNUNET_HashCode h_wire; struct GNUNET_HashCode h_wire;
/**
* Hash of the public denomination key used to sign the coin.
*/
struct GNUNET_HashCode h_denom_pub;
/** /**
* Detailed information about the receiver for executing the transaction. * Detailed information about the receiver for executing the transaction.
* Includes URL in payto://-format and salt. * Includes URL in payto://-format and salt.
@ -781,6 +791,11 @@ struct TALER_EXCHANGEDB_MeltListEntry
*/ */
struct TALER_RefreshCommitmentP rc; struct TALER_RefreshCommitmentP rc;
/**
* Hash of the public denomination key used to sign the coin.
*/
struct GNUNET_HashCode h_denom_pub;
/** /**
* How much value is being melted? This amount includes the fees, * How much value is being melted? This amount includes the fees,
* so the final amount contributed to the melt is this value minus * so the final amount contributed to the melt is this value minus

View File

@ -350,6 +350,11 @@ struct TALER_DepositRequestPS
*/ */
struct GNUNET_HashCode h_wire GNUNET_PACKED; struct GNUNET_HashCode h_wire GNUNET_PACKED;
/**
* Hash over the denomination public key used to sign the coin.
*/
struct GNUNET_HashCode h_denom_pub GNUNET_PACKED;
/** /**
* Time when this request was generated. Used, for example, to * Time when this request was generated. Used, for example, to
* assess when (roughly) the income was achieved for tax purposes. * assess when (roughly) the income was achieved for tax purposes.
@ -579,6 +584,12 @@ struct TALER_RefreshMeltCoinAffirmationPS
*/ */
struct TALER_RefreshCommitmentP rc GNUNET_PACKED; struct TALER_RefreshCommitmentP rc GNUNET_PACKED;
/**
* Hash over the denomination public key used to sign the coin.
* FIXME: add here, initialize everywhere!
*/
// struct GNUNET_HashCode h_denom_pub GNUNET_PACKED;
/** /**
* How much of the value of the coin should be melted? This amount * How much of the value of the coin should be melted? This amount
* includes the fees, so the final amount contributed to the melt is * includes the fees, so the final amount contributed to the melt is

View File

@ -523,6 +523,8 @@ TALER_EXCHANGE_verify_coin_history (
&dr.h_contract_terms), &dr.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("h_wire", GNUNET_JSON_spec_fixed_auto ("h_wire",
&dr.h_wire), &dr.h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&dr.h_denom_pub),
TALER_JSON_spec_absolute_time_nbo ("timestamp", TALER_JSON_spec_absolute_time_nbo ("timestamp",
&dr.wallet_timestamp), &dr.wallet_timestamp),
TALER_JSON_spec_absolute_time_nbo ("refund_deadline", TALER_JSON_spec_absolute_time_nbo ("refund_deadline",

View File

@ -432,6 +432,7 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
.purpose.size = htonl (sizeof (dr)), .purpose.size = htonl (sizeof (dr)),
.h_contract_terms = *h_contract_terms, .h_contract_terms = *h_contract_terms,
.h_wire = *h_wire, .h_wire = *h_wire,
.h_denom_pub = *denom_pub_hash,
.wallet_timestamp = GNUNET_TIME_absolute_hton (timestamp), .wallet_timestamp = GNUNET_TIME_absolute_hton (timestamp),
.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline), .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
.merchant = *merchant_pub, .merchant = *merchant_pub,
@ -497,6 +498,7 @@ verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
* @param deposit_fee the deposit fee we expect to pay * @param deposit_fee the deposit fee we expect to pay
* @param h_wire hash of the merchants account details * @param h_wire hash of the merchants account details
* @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange) * @param h_contract_terms hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
* @param h_denom_pub hash of the coin denomination's public key
* @param coin_priv coins private key * @param coin_priv coins private key
* @param wallet_timestamp timestamp when the contract was finalized, must not be too far in the future * @param wallet_timestamp timestamp when the contract was finalized, must not be too far in the future
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests) * @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
@ -509,6 +511,7 @@ TALER_EXCHANGE_deposit_permission_sign (
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct GNUNET_HashCode *h_wire, const struct GNUNET_HashCode *h_wire,
const struct GNUNET_HashCode *h_contract_terms, const struct GNUNET_HashCode *h_contract_terms,
const struct GNUNET_HashCode *h_denom_pub,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct GNUNET_TIME_Absolute wallet_timestamp, struct GNUNET_TIME_Absolute wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -522,6 +525,7 @@ TALER_EXCHANGE_deposit_permission_sign (
(TALER_SIGNATURE_WALLET_COIN_DEPOSIT), (TALER_SIGNATURE_WALLET_COIN_DEPOSIT),
.h_contract_terms = *h_contract_terms, .h_contract_terms = *h_contract_terms,
.h_wire = *h_wire, .h_wire = *h_wire,
.h_denom_pub = *h_denom_pub,
.wallet_timestamp = GNUNET_TIME_absolute_hton (wallet_timestamp), .wallet_timestamp = GNUNET_TIME_absolute_hton (wallet_timestamp),
.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline), .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
.merchant = *merchant_pub .merchant = *merchant_pub

View File

@ -409,6 +409,7 @@ deposit_run (void *cls,
&denom_pub->fee_deposit, &denom_pub->fee_deposit,
&h_wire, &h_wire,
&h_contract_terms, &h_contract_terms,
&denom_pub->h_key,
coin_priv, coin_priv,
ds->wallet_timestamp, ds->wallet_timestamp,
&merchant_pub, &merchant_pub,