From 62d3d352502f5b1d109b18456a87c704a70fcca5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 28 Jan 2015 20:23:19 +0100 Subject: move coin validity test to libtalerutil --- src/include/taler_util.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/include/taler_util.h') diff --git a/src/include/taler_util.h b/src/include/taler_util.h index ab5ee11df..5ee90a6cc 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -251,6 +251,47 @@ TALER_data_to_string_alloc (const void *buf, size_t size); +/* ****************** Coin crypto primitives ************* */ + +/** + * Public information about a coin (including the public key + * of the coin, the denomination key and the signature with + * the denomination key). + */ +struct TALER_CoinPublicInfo +{ + /** + * The coin's public key. + */ + struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; + + /** + * Public key representing the denomination of the coin + * that is being deposited. + */ + struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub; + + /** + * (Unblinded) signature over @e coin_pub with @e denom_pub, + * which demonstrates that the coin is valid. + */ + struct GNUNET_CRYPTO_rsa_Signature *denom_sig; +}; + + +/** + * Check if a coin is valid; that is, whether the denomination key exists, + * is not expired, and the signature is correct. + * + * @param coin_public_info the coin public info to check for validity + * @return #GNUNET_YES if the coin is valid, + * #GNUNET_NO if it is invalid + * #GNUNET_SYSERROR if an internal error occured + */ +int +TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info); + + /* ****************** Refresh crypto primitives ************* */ /** -- cgit v1.2.3