summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-09 12:29:41 +0100
committerChristian Grothoff <christian@grothoff.org>2015-03-09 12:29:41 +0100
commit579f465c9b2ed1cd4602ee102073d633fda60cb9 (patch)
tree99b546c629bfa876ccbe4f829a68c3fe8d80624a /src/include
parent7b0ae9c1d0a3c3165a8cef8cc12d04d207a49ce2 (diff)
downloadexchange-579f465c9b2ed1cd4602ee102073d633fda60cb9.tar.gz
exchange-579f465c9b2ed1cd4602ee102073d633fda60cb9.tar.bz2
exchange-579f465c9b2ed1cd4602ee102073d633fda60cb9.zip
implementing #3632: generate proof of insufficient funds by converting transaction history to JSON
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_json_lib.h30
-rw-r--r--src/include/taler_signatures.h105
2 files changed, 98 insertions, 37 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index f0ae923f4..2b9d51875 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -60,8 +60,20 @@ TALER_JSON_from_abs (struct GNUNET_TIME_Absolute stamp);
* @return the JSON reporesentation of the signature with purpose
*/
json_t *
-TALER_JSON_from_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
- const struct GNUNET_CRYPTO_EddsaSignature *signature);
+TALER_JSON_from_eddsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+ const struct GNUNET_CRYPTO_EddsaSignature *signature);
+
+
+/**
+ * Convert a signature (with purpose) to a JSON object representation.
+ *
+ * @param purpose purpose of the signature
+ * @param signature the signature
+ * @return the JSON reporesentation of the signature with purpose
+ */
+json_t *
+TALER_JSON_from_ecdsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+ const struct GNUNET_CRYPTO_EcdsaSignature *signature);
/**
@@ -77,6 +89,17 @@ TALER_JSON_from_data (const void *data, size_t size);
/**
+ * Convert binary hash to a JSON string with the base32crockford
+ * encoding.
+ *
+ * @param hc binary data
+ * @return json string that encodes @a hc
+ */
+json_t *
+TALER_JSON_from_hash (const struct GNUNET_HashCode *hc);
+
+
+/**
* Parse given JSON object to Amount
*
* @param json the json object representing Amount
@@ -119,7 +142,8 @@ TALER_JSON_to_data (json_t *json,
* @return 1 if correctly formatted; 0 if not
*/
int
-TALER_JSON_validate_wireformat (const char *type, json_t *wire);
+TALER_JSON_validate_wireformat (const char *type,
+ json_t *wire);
#endif /* TALER_JSON_LIB_H_ */
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 905d1ed23..8984165e6 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -266,83 +266,120 @@ struct RefreshMeltResponseSignatureBody
};
-
-
-
/**
- * FIXME
+ * Message signed by a coin to indicate that the coin should
+ * be melted.
*/
-struct TALER_MINT_SignKeyIssue
+struct RefreshMeltSignatureBody
{
- struct GNUNET_CRYPTO_EddsaSignature signature;
+ /**
+ * Purpose is #TALER_SIGNATURE_REFRESH_MELT.
+ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct GNUNET_CRYPTO_EddsaPublicKey master_pub;
- struct GNUNET_TIME_AbsoluteNBO start;
- struct GNUNET_TIME_AbsoluteNBO expire;
- struct GNUNET_CRYPTO_EddsaPublicKey signkey_pub;
+
+ /**
+ * Which melting operation should the coin become a part of.
+ */
+ struct GNUNET_HashCode melt_hash;
+
+ /**
+ * 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 this value minus the fee for melting the coin.
+ */
+ struct TALER_AmountNBO amount;
};
/**
- * FIXME
+ * Message signed during melting committing the client to the
+ * hashed inputs.
*/
-struct TALER_MINT_DenomKeyIssue
+struct RefreshCommitSignatureBody
{
- struct GNUNET_CRYPTO_EddsaSignature signature;
+ /**
+ * Purpose is #TALER_SIGNATURE_REFRESH_COMMIT.
+ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct GNUNET_CRYPTO_EddsaPublicKey master;
- struct GNUNET_TIME_AbsoluteNBO start;
- struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
- struct GNUNET_TIME_AbsoluteNBO expire_spend;
- // FIXME: does not work like this:
- struct GNUNET_CRYPTO_rsa_PublicKey * denom_pub;
- struct TALER_AmountNBO value;
- struct TALER_AmountNBO fee_withdraw;
- struct TALER_AmountNBO fee_deposit;
- struct TALER_AmountNBO fee_refresh;
+
+ /**
+ * Session state the client commits itself to.
+ */
+ struct GNUNET_HashCode commit_hash;
};
/**
- * FIXME
+ * Message signed by the mint, committing it to a particular
+ * index to not be revealed during the refresh.
*/
-struct RefreshMeltSignatureBody
+struct RefreshCommitResponseSignatureBody
{
+ /**
+ * Purpose is #TALER_SIGNATURE_REFRESH_MELT_RESPONSE.
+ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct GNUNET_HashCode melt_hash;
+
+ /**
+ * Index that the client will not have to reveal.
+ */
+ uint16_t noreveal_index GNUNET_PACKED;
};
+
/**
- * FIXME
+ * Message signed by the client requesting the final
+ * result of the melting operation.
*/
-struct RefreshCommitSignatureBody
+struct RefreshMeltConfirmSignRequestBody
{
+ /**
+ * Purpose is #TALER_SIGNATURE_REFRESH_MELT_CONFIRM.
+ */
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct GNUNET_HashCode commit_hash;
+
+ /**
+ * FIXME.
+ */
+ struct GNUNET_CRYPTO_EddsaPublicKey session_pub;
};
/**
* FIXME
*/
-struct RefreshCommitResponseSignatureBody
+struct TALER_MINT_SignKeyIssue
{
+ struct GNUNET_CRYPTO_EddsaSignature signature;
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- uint16_t noreveal_index;
+ struct GNUNET_CRYPTO_EddsaPublicKey master_pub;
+ struct GNUNET_TIME_AbsoluteNBO start;
+ struct GNUNET_TIME_AbsoluteNBO expire;
+ struct GNUNET_CRYPTO_EddsaPublicKey signkey_pub;
};
-
/**
* FIXME
*/
-struct RefreshMeltConfirmSignRequestBody
+struct TALER_MINT_DenomKeyIssue
{
+ struct GNUNET_CRYPTO_EddsaSignature signature;
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
- struct GNUNET_CRYPTO_EddsaPublicKey session_pub;
+ struct GNUNET_CRYPTO_EddsaPublicKey master;
+ struct GNUNET_TIME_AbsoluteNBO start;
+ struct GNUNET_TIME_AbsoluteNBO expire_withdraw;
+ struct GNUNET_TIME_AbsoluteNBO expire_spend;
+ // FIXME: does not work like this:
+ struct GNUNET_CRYPTO_rsa_PublicKey * denom_pub;
+ struct TALER_AmountNBO value;
+ struct TALER_AmountNBO fee_withdraw;
+ struct TALER_AmountNBO fee_deposit;
+ struct TALER_AmountNBO fee_refresh;
};
+
GNUNET_NETWORK_STRUCT_END
#endif