From 7c099e5053adbb56dfe95a71016b9f3a4a3c625a Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 5 Dec 2016 10:02:46 +0800 Subject: [PATCH] how to get base64 encoded data in Windows added --- src/page.h | 36 ++++++++++++++++---------------- src/templates/rawkeyimgs.html | 1 + src/templates/rawoutputkeys.html | 2 +- src/templates/rawtx.html | 1 + 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/page.h b/src/page.h index 661cc8c..a70f066 100644 --- a/src/page.h +++ b/src/page.h @@ -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, diff --git a/src/templates/rawkeyimgs.html b/src/templates/rawkeyimgs.html index 8ecf91c..49460e4 100644 --- a/src/templates/rawkeyimgs.html +++ b/src/templates/rawkeyimgs.html @@ -25,6 +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)


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 3ed785d..60c4a54 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)


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 7330423..01caf4e 100644 --- a/src/templates/rawtx.html +++ b/src/templates/rawtx.html @@ -26,6 +26,7 @@ Paste base64 encoded, 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)