aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-06 17:05:24 +0200
committerChristian Grothoff <christian@grothoff.org>2015-05-06 17:05:24 +0200
commitda9ab66d2ea379a6fbb5e38c7206070b44d571fa (patch)
treef1d4dfa9eda777af4d48ee152ca104bfca79749e /src/include
parent74a21a5259f9dbcb3a9df887cefe70de0567fd63 (diff)
simplify PG logic by having libtalerpq handle RSA signature/key encoding
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h10
-rw-r--r--src/include/taler_pq_lib.h54
2 files changed, 56 insertions, 8 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 9ba13a6eb..0ab05f5d0 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -244,8 +244,6 @@ struct TALER_CoinSpendSignatureP
GNUNET_NETWORK_STRUCT_END
-
-
/**
* @brief Type of blinding keys for Taler.
*/
@@ -427,7 +425,7 @@ struct TALER_RefreshLinkEncrypted
* Decrypt the shared @a secret from the information in the
* encrypted link secret @e secret_enc using the transfer
* private key and the coin's public key.
- *
+ *
* @param secret_enc encrypted link secret
* @param transfer_priv transfer private key
* @param coin_pub coin public key
@@ -445,7 +443,7 @@ TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc,
* Decrypt the shared @a secret from the information in the
* encrypted link secret @e secret_enc using the transfer
* public key and the coin's private key.
- *
+ *
* @param secret_enc encrypted link secret
* @param transfer_pub transfer public key
* @param coin_priv coin private key
@@ -462,8 +460,8 @@ TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc,
/**
* Encrypt the shared @a secret to generate the encrypted link secret.
* Also creates the transfer key.
- *
- * @param secret link secret to encrypt
+ *
+ * @param secret link secret to encrypt
* @param coin_pub coin public key
* @param transfer_priv[out] set to transfer private key
* @param transfer_pub[out] set to transfer public key
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