verifiction of output data decryption added

This commit is contained in:
moneroexamples 2016-12-05 10:46:04 +08:00
parent 7c099e5053
commit a7ef6506a0
4 changed files with 17 additions and 5 deletions

View File

@ -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);

View File

@ -25,7 +25,7 @@
<form action="/checkrawkeyimgs" method="post" style="width:100%; margin-top:15px" class="style-1">
Paste base64 encoded, signed key images data here<br/>
(In Linux, can get base64 signed raw tx data: <i>base64 your_key_images_file | xclip -selection clipboard</i>)<br/>
(In Windows, can get base64 signed raw tx data: <i>certutil.exe -encode -f your_key_images_file encoded.txt; type "encoded.txt" | clip</i>)<br/>
(In Windows, can get base64 signed raw tx data: <i>certutil.exe -encode -f your_key_images_file encoded.txt & type "encoded.txt" | clip</i>)<br/>
<textarea name="rawkeyimgsdata" rows="20" cols="80"></textarea><br/><br/>
Viewkey (<i>key image file data is encoded using your viewkey. Thus is needed for decryption</i>)
<br/>

View File

@ -25,7 +25,7 @@
<form action="/checkrawoutputkeys" method="post" style="width:100%; margin-top:15px" class="style-1">
Paste base64 encoded, signed output keys data here<br/>
(In Linux, can get base64 signed raw tx data: <i>base64 your_output_keys_filename | xclip -selection clipboard</i>)<br/>
(In Windows, can get base64 signed raw tx data: <i>certutil.exe -encode -f your_output_keys_filename encoded.txt; type "encoded.txt" | clip</i>)<br/>
(In Windows, can get base64 signed raw tx data: <i>certutil.exe -encode -f your_output_keys_filename encoded.txt & type "encoded.txt" | clip</i>)<br/>
<textarea name="rawoutputkeysdata" rows="20" cols="80"></textarea><br/><br/>
Viewkey (<i>output keys file data is encoded using your viewkey. Thus is needed for decryption</i>)
<br/>

View File

@ -24,9 +24,9 @@
<div class="center">
<form action="/checkandpush" method="post" style="width:100%; margin-top:15px" class="style-1">
Paste base64 encoded, signed transaction data here<br/>
Paste base64 encoded, unsigned or signed transaction data here<br/>
(In Linux, can get base64 signed raw tx data: <i>base64 signed_monero_tx | xclip -selection clipboard</i>)<br/>
(In Windows, can get base64 signed raw tx data: <i>certutil.exe -encode -f signed_monero_tx encoded.txt; type "encoded.txt" | clip</i>)<br/>
(In Windows, can get base64 signed raw tx data: <i>certutil.exe -encode -f signed_monero_tx encoded.txt & type "encoded.txt" | clip</i>)<br/>
<textarea name="rawtxdata" rows="20" cols="80"></textarea>
<br/>
<input type="submit" name="action" value="check">