[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 04/10: Worked on escrow challenge
From: |
gnunet |
Subject: |
[taler-anastasis] 04/10: Worked on escrow challenge |
Date: |
Wed, 15 Jan 2020 23:42:28 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 12b1eb42cf4b27e375872d12032f7bd00a162fc0
Author: Dennis Neufeld <address@hidden>
AuthorDate: Fri Jan 3 22:00:04 2020 +0000
Worked on escrow challenge
---
src/backend/anastasis-httpd_policy_upload.c | 2 +-
src/backend/anastasis-httpd_truth.c | 78 +++++++++++++++++++++++++++++
src/backend/anastasis-httpd_truth_upload.c | 2 +-
src/include/anastasis_database_plugin.h | 6 +--
src/stasis/plugin_anastasis_postgres.c | 6 +--
5 files changed, 86 insertions(+), 8 deletions(-)
diff --git a/src/backend/anastasis-httpd_policy_upload.c
b/src/backend/anastasis-httpd_policy_upload.c
index 0581af7..15b3c05 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -695,7 +695,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
MHD_HTTP_BAD_REQUEST,
// FIXME: find error code
TALER_EC_SYNC_BAD_IF_MATCH,
- "Payment-Identifier does not
include a base32-encoded SHA-512 hash");
+ "Payment-Identifier does not
include a base32-encoded Payment-Identifier");
}
}
{
diff --git a/src/backend/anastasis-httpd_truth.c
b/src/backend/anastasis-httpd_truth.c
index 55e0f8a..584f145 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -39,5 +39,83 @@ AH_handler_truth_get (struct MHD_Connection *connection,
void **con_cls)
{
// FIXME: Handle truth get
+ uuid_t uuid;
+ struct ANASTASIS_CRYPTO_truth_key decryption_key;
+ struct GNUNET_HashCode challenge_response;
+ void *encrypted_truth;
+ char *truth_mime;
+ int ret;
+
+ /* extract uuid from url */
+ GNUNET_assert (0 == strncmp (url,
+ "/truth/",
+ strlen ("/truth/")));
+ {
+ const char *uuid_str;
+
+ uuid_str = &url[strlen ("/truth/")];
+ uuid_parse (uuid_str, uuid);
+ }
+ {
+ // check if header contains Truth-Decryption-Key
+ const char *tdk;
+
+ tdk = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ "Truth-Decryption-Key");
+
+ if ( (NULL != tdk) &&
+ (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (tdk,
+ strlen (tdk),
+ &decryption_key,
+ sizeof (&decryption_key))))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ // FIXME: find error code
+ TALER_EC_SYNC_BAD_IF_MATCH,
+ "Truth-Decryption-Key does not
include a base32-encoded decryption key");
+ }
+ else
+ return MHD_HTTP_PRECONDITION_FAILED;
+ }
+ {
+ // check if header contains Challenge-Response
+ const char *cr;
+
+ cr = MHD_lookup_connection_value (connection,
+ MHD_HEADER_KIND,
+ "Challenge-Response");
+
+ if ( (NULL != cr) &&
+ (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (cr,
+ strlen (cr),
+ &challenge_response,
+ sizeof (&challenge_response))))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ // FIXME: find error code
+ TALER_EC_SYNC_BAD_IF_MATCH,
+ "Challenge_Response does not include
a base32-encoded challenge response");
+ }
+ else
+ return MHD_HTTP_PRECONDITION_FAILED;
+ }
+ {
+ //Validate challenge response
+ enum ANASTASIS_DB_QueryStatus qs;
+
+ qs = db->get_escrow_challenge (db->cls,
+ &uuid,
+ &encrypted_truth,
+ sizeof (&encrypted_truth),
+ &truth_mime);
+ }
+
return MHD_NO;
}
\ No newline at end of file
diff --git a/src/backend/anastasis-httpd_truth_upload.c
b/src/backend/anastasis-httpd_truth_upload.c
index e6477e2..fc6c48c 100644
--- a/src/backend/anastasis-httpd_truth_upload.c
+++ b/src/backend/anastasis-httpd_truth_upload.c
@@ -76,7 +76,7 @@ AH_handler_truth_post (struct MHD_Connection *connection,
int res;
struct ANASTASIS_DB_Truth truth;
- /* extract publickey from url */
+ /* extract uuid from url */
GNUNET_assert (0 == strncmp (url,
"/truth/",
strlen ("/truth/")));
diff --git a/src/include/anastasis_database_plugin.h
b/src/include/anastasis_database_plugin.h
index 8c87130..f5dd623 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -39,7 +39,7 @@ struct ANASTASIS_DB_Truth
uint32_t nonce;
// AES_GCM_Tag
- unsigned char aes_gcm_tag[16];
+ const unsigned char aes_gcm_tag[16];
const void *encrypted_truth;
@@ -268,8 +268,8 @@ struct ANASTASIS_DatabasePlugin
/**
* @param cls closure
* @param uuid the identifier for the Truth
- * @param truth contains the truth (base32 encoded)
- * @param truth_size size of truth
+ * @param truth contains the encrypted truth
+ * @param truth_size size of the encrypted truth
* @param truth_mime mime type of truth
* @return transaction status
*/
diff --git a/src/stasis/plugin_anastasis_postgres.c
b/src/stasis/plugin_anastasis_postgres.c
index eb5411d..1d28e2a 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -800,12 +800,12 @@ postgres_store_truth (void *cls,
/**
- * Get the challenge from the truth i.e. Security Question, SMS, E-Mail
+ * Get the encrypted truth to validate the challenge response
*
* @param cls closure
* @param uuid the identifier for the Truth
- * @param truth contains the truth (base32 encoded)
- * @param truth_size size of truth
+ * @param truth contains the encrypted truth
+ * @param truth_size size of encrypted truth
* @param truth_mime mime type of truth
* @return transaction status
*/
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-anastasis] branch master updated (62e9415 -> 673a9dc), gnunet, 2020/01/15
- [taler-anastasis] 01/10: Added testing command for policy lookup, gnunet, 2020/01/15
- [taler-anastasis] 08/10: Worked on uploading truth, gnunet, 2020/01/15
- [taler-anastasis] 10/10: Merged, gnunet, 2020/01/15
- [taler-anastasis] 03/10: Modified db table anastasis_truth, gnunet, 2020/01/15
- [taler-anastasis] 04/10: Worked on escrow challenge,
gnunet <=
- [taler-anastasis] 09/10: Merged, gnunet, 2020/01/15
- [taler-anastasis] 05/10: Worked on escrow challenge, gnunet, 2020/01/15
- [taler-anastasis] 07/10: Worked on truth upload, gnunet, 2020/01/15
- [taler-anastasis] 06/10: Worked on escrow challenge, gnunet, 2020/01/15
- [taler-anastasis] 02/10: Worked on truth upload, gnunet, 2020/01/15