diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-05-06 17:05:24 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-05-06 17:05:24 +0200 |
commit | da9ab66d2ea379a6fbb5e38c7206070b44d571fa (patch) | |
tree | f1d4dfa9eda777af4d48ee152ca104bfca79749e /src/include/taler_pq_lib.h | |
parent | 74a21a5259f9dbcb3a9df887cefe70de0567fd63 (diff) |
simplify PG logic by having libtalerpq handle RSA signature/key encoding
Diffstat (limited to 'src/include/taler_pq_lib.h')
-rw-r--r-- | src/include/taler_pq_lib.h | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h index 6bf5c0c82..e32dea54a 100644 --- a/src/include/taler_pq_lib.h +++ b/src/include/taler_pq_lib.h @@ -49,9 +49,28 @@ enum TALER_PQ_QueryFormat /** * We have a currency amount (with endianess conversion). - * Data points to a `struct TALER_AmountNBO`, size is not used. + * Data points to a `struct TALER_AmountNBO`, size is only used to check. */ - TALER_PQ_QF_AMOUNT_NBO + TALER_PQ_QF_AMOUNT_NBO, + + /** + * We have a currency amount (with endianess conversion). + * Data points to a `struct TALER_Amount`, size is only used to check. + */ + TALER_PQ_QF_AMOUNT, + + /** + * We have an RSA public key. + * Data points to a `struct GNUNET_CRYPTO_rsa_PublicKey`, size is not used. + */ + TALER_PQ_QF_RSA_PUBLIC_KEY, + + /** + * We have an RSA signature. + * Data points to a `struct GNUNET_CRYPTO_rsa_Signature`, size is not used. + */ + TALER_PQ_QF_RSA_SIGNATURE + }; @@ -114,6 +133,37 @@ struct TALER_PQ_QueryParam /** + * Generate query parameter for a currency, consisting of the three + * components "value", "fraction" and "currency" in this order. The + * types must be a 64-bit integer, 32-bit integer and a + * TALER_CURRENCY_LEN-sized BLOB/VARCHAR respectively. + * + * @param x pointer to the query parameter to pass, must be + * a variable of type `struct TALER_Amount`. + */ +#define TALER_PQ_QUERY_PARAM_AMOUNT(x) { TALER_PQ_QF_AMOUNT, &(x), sizeof (x) } + + +/** + * Generate query parameter for an RSA public key. The + * database must contain a BLOB type in the respective position. + * + * @param x the query parameter to pass, must be + * a variable of type `struct GNUNET_CRYPTO_rsa_PublicKey *`. + */ +#define TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY(x) { TALER_PQ_QF_RSA_PUBLIC_KEY, (x),0 } + +/** + * Generate query parameter for an RSA signature. The + * database must contain a BLOB type in the respective position. + * + * @param x the query parameter to pass, must be + * a variable of type `struct GNUNET_CRYPTO_rsa_Signature *`. + */ +#define TALER_PQ_QUERY_PARAM_RSA_SIGNATURE(x) { TALER_PQ_QF_RSA_SIGNATURE, (x),0 } + + +/** * Different formats of results that can be extracted. */ enum TALER_PQ_ResultFormat |