diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/taler_mint_service.h | 45 | ||||
-rw-r--r-- | src/include/taler_signatures.h | 143 | ||||
-rw-r--r-- | src/include/taler_types.h | 120 |
4 files changed, 164 insertions, 145 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index c95940ea2..ebdf8561d 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -7,5 +7,4 @@ talerinclude_HEADERS = \ taler_mint_service.h \ taler_rsa.h \ taler_signatures.h \ - taler_types.h \ taler_util.h diff --git a/src/include/taler_mint_service.h b/src/include/taler_mint_service.h index ee3b30e39..a9d27982f 100644 --- a/src/include/taler_mint_service.h +++ b/src/include/taler_mint_service.h @@ -3,23 +3,21 @@ (C) 2014 Christian Grothoff (and other contributing authors) TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software + terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. TALER is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. + A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - You should have received a copy of the GNU General Public License along with + You should have received a copy of the GNU Affero General Public License along with TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ - /** * @file include/taler_mint_service.h - * @brief C interface to the mint's HTTP API - * @author Sree Harsha Totakura <sreeharsha@totakura.in> + * @brief C interface of libtalermint, a C library to use mint's HTTP API + * @author Sree Harsha Totakura <sreeharsha@totakura.in> */ - #ifndef _TALER_MINT_SERVICE_H #define _TALER_MINT_SERVICE_H @@ -166,8 +164,9 @@ struct TALER_MINT_KeysGetHandle; * @param emsg if the asynchronous call could not be completed due to an error, * this parameter contains a human readable error message */ -typedef void (*TALER_MINT_ContinuationCallback) (void *cls, - const char *emsg); +typedef void +(*TALER_MINT_ContinuationCallback) (void *cls, + const char *emsg); /** * Functions of this type are called to provide the retrieved signing and @@ -180,9 +179,10 @@ typedef void (*TALER_MINT_ContinuationCallback) (void *cls, * @param denom_keys NULL-terminated array of pointers to the mint's * denomination keys; will be NULL if no signing keys are retrieved. */ -typedef void (*TALER_MINT_KeysGetCallback) (void *cls, - struct TALER_MINT_SigningPublicKey **sign_keys, - struct TALER_MINT_DenomPublicKey **denom_keys); +typedef void +(*TALER_MINT_KeysGetCallback) (void *cls, + struct TALER_MINT_SigningPublicKey **sign_keys, + struct TALER_MINT_DenomPublicKey **denom_keys); /** @@ -190,15 +190,18 @@ typedef void (*TALER_MINT_KeysGetCallback) (void *cls, * * @param mint handle to the mint * @param cb the callback to call with the keys - * @param cls closure for the above callback + * @param cb_cls closure for the @a cb callback * @param cont_cb the callback to call after completing this asynchronous call - * @param cont_cls the closure for the continuation callback + * @param cont_cls the closure for the @a cont_cb callback * @return a handle to this asynchronous call; NULL upon eror */ struct TALER_MINT_KeysGetHandle * TALER_MINT_keys_get (struct TALER_MINT_Handle *mint, - TALER_MINT_KeysGetCallback cb, void *cls, - TALER_MINT_ContinuationCallback cont_cb, void *cont_cls); + TALER_MINT_KeysGetCallback cb, + void *cb_cls, + TALER_MINT_ContinuationCallback cont_cb, + void *cont_cls); + /** * Cancel the asynchronous call initiated by TALER_MINT_keys_get(). This should @@ -229,10 +232,12 @@ struct TALER_MINT_DepositHandle; * @param emsg in case of unsuccessful deposit, this contains a human readable * explanation. */ -typedef void (*TALER_MINT_DepositResultCallback) (void *cls, - int status, - json_t *obj, - char *emsg); +typedef void +(*TALER_MINT_DepositResultCallback) (void *cls, + int status, + json_t *obj, + char *emsg); + /** * Submit a deposit permission to the mint and get the mint's response diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index 8c142f61f..238a915c1 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -13,18 +13,25 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ - /** - * @file taler-mint-keyup.c - * @brief Update the mint's keys for coins and signatures, - * using the mint's offline master key. + * @file taler_signatures.h + * @brief message formats and signature constants used to define + * the binary formats of signatures in Taler * @author Florian Dold * @author Benedikt Mueller + * + * This file should define the constants and C structs that one + * needs to know to implement Taler clients (wallets or merchants) + * that need to produce or verify Taler signatures. */ #ifndef TALER_SIGNATURES_H #define TALER_SIGNATURES_H +#include <gnunet/gnunet_util_lib.h> +#include "taler_rsa.h" + + /** * Purpose for signing public keys signed * by the mint master key. @@ -102,5 +109,133 @@ */ #define TALER_SIGNATURE_INCREMENTAL_DEPOSIT 202 + + +GNUNET_NETWORK_STRUCT_BEGIN + + +/** + * Request to withdraw coins from a reserve. + */ +struct TALER_WithdrawRequest +{ + /** + * Signature over the rest of the message + * by the withdraw public key. + */ + struct GNUNET_CRYPTO_EddsaSignature sig; + + /** + * Purpose must be #TALER_SIGNATURE_WITHDRAW. + */ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + + /** + * Reserve public key. + */ + struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; + + /** + * Denomination public key for the coin that is withdrawn. + * FIXME: change to the hash of the public key (so this + * is fixed-size). + */ + struct TALER_RSA_PublicKeyBinaryEncoded denomination_pub; + + /** + * Purpose containing coin's blinded public key. + * + * FIXME: this should be explicitly a variable-size field with the + * (blinded) message to be signed by the Mint. + */ + struct TALER_RSA_BlindedSignaturePurpose coin_envelope; +}; + + + +/** + * FIXME + */ +struct TALER_MINT_SignKeyIssue +{ + struct GNUNET_CRYPTO_EddsaSignature signature; + 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; +}; + + +/** + * FIXME + */ +struct TALER_MINT_DenomKeyIssue +{ + struct GNUNET_CRYPTO_EddsaSignature signature; + 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; + struct TALER_RSA_PublicKeyBinaryEncoded denom_pub; + struct TALER_AmountNBO value; + struct TALER_AmountNBO fee_withdraw; + struct TALER_AmountNBO fee_deposit; + struct TALER_AmountNBO fee_refresh; +}; + + +/** + * FIXME + */ +struct RefreshMeltSignatureBody +{ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_HashCode melt_hash; +}; + +/** + * FIXME + */ +struct RefreshCommitSignatureBody +{ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_HashCode commit_hash; +}; + + +/** + * FIXME + */ +struct RefreshCommitResponseSignatureBody +{ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + uint16_t noreveal_index; +}; + + +/** + * FIXME + */ +struct RefreshMeltResponseSignatureBody +{ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_HashCode melt_response_hash; +}; + + +/** + * FIXME + */ +struct RefreshMeltConfirmSignRequestBody +{ + struct GNUNET_CRYPTO_EccSignaturePurpose purpose; + struct GNUNET_CRYPTO_EddsaPublicKey session_pub; +}; + + +GNUNET_NETWORK_STRUCT_END + #endif diff --git a/src/include/taler_types.h b/src/include/taler_types.h deleted file mode 100644 index c6c2c0209..000000000 --- a/src/include/taler_types.h +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @file include/types.h - * @brief This files defines the various data and message types in TALER. - * @author Sree Harsha Totakura <sreeharsha@totakura.in> - * @author Florian Dold - */ - -#ifndef TYPES_H_ -#define TYPES_H_ - -#include "taler_rsa.h" - - -/** - * Public information about a coin. - */ -struct TALER_CoinPublicInfo -{ - /** - * The coin's public key. - */ - struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub; - - /* - * The public key signifying the coin's denomination. - */ - struct TALER_RSA_PublicKeyBinaryEncoded denom_pub; - - /** - * Signature over coin_pub by denom_pub. - */ - struct TALER_RSA_Signature denom_sig; -}; - - -/** - * Request to withdraw coins from a reserve. - */ -struct TALER_WithdrawRequest -{ - /** - * Signature over the rest of the message - * by the withdraw public key. - */ - struct GNUNET_CRYPTO_EddsaSignature sig; - - /** - * Purpose must be TALER_SIGNATURE_WITHDRAW. - */ - struct GNUNET_CRYPTO_EccSignaturePurpose purpose; - - /** - * Reserve public key. - */ - struct GNUNET_CRYPTO_EddsaPublicKey reserve_pub; - - /** - * Denomination public key for the coin that is withdrawn. - */ - struct TALER_RSA_PublicKeyBinaryEncoded denomination_pub; - - /** - * Purpose containing coin's blinded public key. - */ - struct TALER_RSA_BlindedSignaturePurpose coin_envelope; -}; - - - -/** - * Data type for messages - */ -struct TALER_MessageHeader -{ - /** - * The type of the message in Network-byte order (NBO) - */ - uint16_t type; - - /** - * The size of the message in NBO - */ - uint16_t size; -}; - -/*****************/ -/* Message types */ -/*****************/ - -/** - * The message type of a blind signature - */ -#define TALER_MSG_TYPE_BLINDED_SIGNATURE 1 - -/** - * The message type of a blinded message - */ -#define TALER_MSG_TYPE_BLINDED_MESSAGE 2 - -/** - * The message type of an unblinded signature - * @FIXME: Not currently used - */ -#define TALER_MSG_TYPE_UNBLINDED_SIGNATURE 3 - -/** - * The type of a blinding residue message - * @FIXME: Not currently used - */ -#define TALER_MSG_TYPE_BLINDING_RESIDUE 4 - -/** - * The type of a message containing the blinding factor - */ -#define TALER_MSG_TYPE_BLINDING_FACTOR 5 - - -#endif /* TYPES_H_ */ - -/* end of include/types.h */ |