how to get base64 encoded data in Windows added

This commit is contained in:
moneroexamples 2016-12-05 10:02:46 +08:00
parent a9ac4166be
commit 7c099e5053
4 changed files with 21 additions and 19 deletions

View File

@ -1308,12 +1308,7 @@ public:
string
show_checkrawtx(string raw_tx_data, string action)
{
// remove white characters
boost::trim(raw_tx_data);
boost::erase_all(raw_tx_data, "\r\n");
boost::erase_all(raw_tx_data, "\n");
//cout << raw_tx_data << endl;
clean_post_data(raw_tx_data);
string decoded_raw_tx_data = epee::string_encoding::base64_decode(raw_tx_data);
@ -1830,10 +1825,7 @@ public:
string
show_pushrawtx(string raw_tx_data, string action)
{
// remove white characters
boost::trim(raw_tx_data);
boost::erase_all(raw_tx_data, "\r\n");
boost::erase_all(raw_tx_data, "\n");
clean_post_data(raw_tx_data);
string decoded_raw_tx_data = epee::string_encoding::base64_decode(raw_tx_data);
@ -2046,10 +2038,7 @@ public:
string
show_checkrawkeyimgs(string raw_data, string viewkey_str)
{
// remove white characters
boost::trim(raw_data);
boost::erase_all(raw_data, "\r\n");
boost::erase_all(raw_data, "\n");
clean_post_data(raw_data);
// remove white characters
boost::trim(viewkey_str);
@ -2403,10 +2392,7 @@ public:
show_checkcheckrawoutput(string raw_data, string viewkey_str)
{
// remove white characters
boost::trim(raw_data);
boost::erase_all(raw_data, "\r\n");
boost::erase_all(raw_data, "\n");
clean_post_data(raw_data);
// remove white characters
boost::trim(viewkey_str);
@ -3919,6 +3905,20 @@ private:
return txd;
}
void
clean_post_data(string& raw_tx_data)
{
// remove white characters
boost::trim(raw_tx_data);
boost::erase_all(raw_tx_data, "\r\n");
boost::erase_all(raw_tx_data, "\n");
// remove header and footer from base64 data
// produced by certutil.exe in windows
boost::erase_all(raw_tx_data, "-----BEGIN CERTIFICATE-----");
boost::erase_all(raw_tx_data, "-----END CERTIFICATE-----");
}
bool
get_txs_from_timestamp_range(
uint64_t timestamp_start,

View File

@ -25,6 +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/>
<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/>
<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

@ -26,6 +26,7 @@
<form action="/checkandpush" method="post" style="width:100%; margin-top:15px" class="style-1">
Paste base64 encoded, 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/>
<textarea name="rawtxdata" rows="20" cols="80"></textarea>
<br/>
<input type="submit" name="action" value="check">