diff options
Diffstat (limited to 'src/mint/taler-mint-httpd_keys.c')
-rw-r--r-- | src/mint/taler-mint-httpd_keys.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/mint/taler-mint-httpd_keys.c b/src/mint/taler-mint-httpd_keys.c index aa1e2c6e6..24851575a 100644 --- a/src/mint/taler-mint-httpd_keys.c +++ b/src/mint/taler-mint-httpd_keys.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <pthread.h> | 32 | #include <pthread.h> |
33 | #include "mint.h" | 33 | #include "mint.h" |
34 | #include "taler_signatures.h" | 34 | #include "taler_signatures.h" |
35 | #include "taler_rsa.h" | ||
36 | #include "taler_json_lib.h" | 35 | #include "taler_json_lib.h" |
37 | #include "taler-mint-httpd_parsing.h" | 36 | #include "taler-mint-httpd_parsing.h" |
38 | #include "taler-mint-httpd_keys.h" | 37 | #include "taler-mint-httpd_keys.h" |
@@ -66,14 +65,23 @@ static int reload_pipe[2]; | |||
66 | static json_t * | 65 | static json_t * |
67 | denom_key_issue_to_json (const struct TALER_MINT_DenomKeyIssue *dki) | 66 | denom_key_issue_to_json (const struct TALER_MINT_DenomKeyIssue *dki) |
68 | { | 67 | { |
68 | char *buf; | ||
69 | size_t buf_len; | ||
69 | json_t *dk_json = json_object (); | 70 | json_t *dk_json = json_object (); |
71 | |||
70 | json_object_set_new (dk_json, "master_sig", | 72 | json_object_set_new (dk_json, "master_sig", |
71 | TALER_JSON_from_data (&dki->signature, sizeof (struct GNUNET_CRYPTO_EddsaSignature))); | 73 | TALER_JSON_from_data (&dki->signature, sizeof (struct GNUNET_CRYPTO_EddsaSignature))); |
72 | json_object_set_new (dk_json, "stamp_start", TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->start))); | 74 | json_object_set_new (dk_json, "stamp_start", TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->start))); |
73 | json_object_set_new (dk_json, "stamp_expire_withdraw", TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_withdraw))); | 75 | json_object_set_new (dk_json, "stamp_expire_withdraw", TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_withdraw))); |
74 | json_object_set_new (dk_json, "stamp_expire_deposit", TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_spend))); | 76 | json_object_set_new (dk_json, "stamp_expire_deposit", TALER_JSON_from_abs (GNUNET_TIME_absolute_ntoh (dki->expire_spend))); |
77 | |||
78 | |||
79 | buf_len = GNUNET_CRYPTO_rsa_public_key_encode (dki->denom_pub, | ||
80 | &buf); | ||
75 | json_object_set_new (dk_json, "denom_pub", | 81 | json_object_set_new (dk_json, "denom_pub", |
76 | TALER_JSON_from_data (&dki->denom_pub, sizeof (struct TALER_RSA_PublicKeyBinaryEncoded))); | 82 | TALER_JSON_from_data (buf, |
83 | buf_len)); | ||
84 | GNUNET_free (buf); | ||
77 | json_object_set_new (dk_json, "value", | 85 | json_object_set_new (dk_json, "value", |
78 | TALER_JSON_from_amount (TALER_amount_ntoh (dki->value))); | 86 | TALER_JSON_from_amount (TALER_amount_ntoh (dki->value))); |
79 | json_object_set_new (dk_json, | 87 | json_object_set_new (dk_json, |
@@ -341,14 +349,19 @@ TALER_MINT_key_state_acquire (void) | |||
341 | */ | 349 | */ |
342 | struct TALER_MINT_DenomKeyIssuePriv * | 350 | struct TALER_MINT_DenomKeyIssuePriv * |
343 | TALER_MINT_get_denom_key (const struct MintKeyState *key_state, | 351 | TALER_MINT_get_denom_key (const struct MintKeyState *key_state, |
344 | const struct TALER_RSA_PublicKeyBinaryEncoded *denom_pub) | 352 | const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub) |
345 | { | 353 | { |
346 | struct TALER_MINT_DenomKeyIssuePriv *issue; | 354 | struct TALER_MINT_DenomKeyIssuePriv *issue; |
347 | struct GNUNET_HashCode hash; | 355 | struct GNUNET_HashCode hash; |
356 | char *buf; | ||
357 | size_t buf_len; | ||
348 | 358 | ||
349 | GNUNET_CRYPTO_hash (denom_pub, | 359 | buf_len = GNUNET_CRYPTO_rsa_public_key_encode (denom_pub, |
350 | sizeof (struct TALER_RSA_PublicKeyBinaryEncoded), | 360 | *buf); |
361 | GNUNET_CRYPTO_hash (buf, | ||
362 | buf_len, | ||
351 | &hash); | 363 | &hash); |
364 | GNUNET_free (buf); | ||
352 | issue = GNUNET_CONTAINER_multihashmap_get (key_state->denomkey_map, &hash); | 365 | issue = GNUNET_CONTAINER_multihashmap_get (key_state->denomkey_map, &hash); |
353 | return issue; | 366 | return issue; |
354 | } | 367 | } |
@@ -373,10 +386,10 @@ TALER_MINT_test_coin_valid (const struct MintKeyState *key_state, | |||
373 | dki = TALER_MINT_get_denom_key (key_state, &coin_public_info->denom_pub); | 386 | dki = TALER_MINT_get_denom_key (key_state, &coin_public_info->denom_pub); |
374 | if (NULL == dki) | 387 | if (NULL == dki) |
375 | return GNUNET_NO; | 388 | return GNUNET_NO; |
376 | if (GNUNET_OK != TALER_RSA_verify (&coin_public_info->coin_pub, | 389 | if (GNUNET_OK != |
377 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), | 390 | GNUNET_CRYPTO_rsa_verify (&c_hash, |
378 | &coin_public_info->denom_sig, | 391 | coin_public_info->denom_sig, |
379 | &dki->issue.denom_pub)) | 392 | dki->issue.denom_pub)) |
380 | { | 393 | { |
381 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 394 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
382 | "coin signature is invalid\n"); | 395 | "coin signature is invalid\n"); |