From a7ef6506a06a75b8e294025d2948f3c3ebafaa97 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 5 Dec 2016 10:46:04 +0800 Subject: [PATCH] verifiction of output data decryption added --- src/page.h | 14 +++++++++++++- src/templates/rawkeyimgs.html | 2 +- src/templates/rawoutputkeys.html | 2 +- src/templates/rawtx.html | 4 ++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/page.h b/src/page.h index a70f066..5a345a0 100644 --- a/src/page.h +++ b/src/page.h @@ -2439,7 +2439,6 @@ public: const size_t magiclen = strlen(OUTPUT_EXPORT_FILE_MAGIC); - if (!strncmp(decoded_raw_data.c_str(), OUTPUT_EXPORT_FILE_MAGIC, magiclen) == 0) { string error_msg = fmt::format("This does not seem to be output keys export data."); @@ -2450,12 +2449,25 @@ public: return mstch::render(full_page, context); } + // decrypt key images data using private view key decoded_raw_data = xmreg::decrypt( std::string(decoded_raw_data, magiclen), prv_view_key, true); + if (decoded_raw_data.empty()) + { + string error_msg = fmt::format("Failed to authenticate outputs data. " + "Maybe wrong viewkey was porvided?"); + + context["has_error"] = true; + context["error_msg"] = error_msg; + + return mstch::render(full_page, context); + } + + // header is public spend and keys const size_t header_lenght = 2 * sizeof(crypto::public_key); diff --git a/src/templates/rawkeyimgs.html b/src/templates/rawkeyimgs.html index 49460e4..fef4d67 100644 --- a/src/templates/rawkeyimgs.html +++ b/src/templates/rawkeyimgs.html @@ -25,7 +25,7 @@
Paste base64 encoded, signed key images data here
(In Linux, can get base64 signed raw tx data: base64 your_key_images_file | xclip -selection clipboard)
- (In Windows, can get base64 signed raw tx data: certutil.exe -encode -f your_key_images_file encoded.txt; type "encoded.txt" | clip)
+ (In Windows, can get base64 signed raw tx data: certutil.exe -encode -f your_key_images_file encoded.txt & type "encoded.txt" | clip)


Viewkey (key image file data is encoded using your viewkey. Thus is needed for decryption)
diff --git a/src/templates/rawoutputkeys.html b/src/templates/rawoutputkeys.html index 60c4a54..5b07489 100644 --- a/src/templates/rawoutputkeys.html +++ b/src/templates/rawoutputkeys.html @@ -25,7 +25,7 @@ Paste base64 encoded, signed output keys data here
(In Linux, can get base64 signed raw tx data: base64 your_output_keys_filename | xclip -selection clipboard)
- (In Windows, can get base64 signed raw tx data: certutil.exe -encode -f your_output_keys_filename encoded.txt; type "encoded.txt" | clip)
+ (In Windows, can get base64 signed raw tx data: certutil.exe -encode -f your_output_keys_filename encoded.txt & type "encoded.txt" | clip)


Viewkey (output keys file data is encoded using your viewkey. Thus is needed for decryption)
diff --git a/src/templates/rawtx.html b/src/templates/rawtx.html index 01caf4e..2f483c5 100644 --- a/src/templates/rawtx.html +++ b/src/templates/rawtx.html @@ -24,9 +24,9 @@
- Paste base64 encoded, signed transaction data here
+ Paste base64 encoded, unsigned or signed transaction data here
(In Linux, can get base64 signed raw tx data: base64 signed_monero_tx | xclip -selection clipboard)
- (In Windows, can get base64 signed raw tx data: certutil.exe -encode -f signed_monero_tx encoded.txt; type "encoded.txt" | clip)
+ (In Windows, can get base64 signed raw tx data: certutil.exe -encode -f signed_monero_tx encoded.txt & type "encoded.txt" | clip)