aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-03 21:15:10 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-09 10:13:41 +0100
commite40cfc4e29e046bc57a5995cfd0d46022b7bf285 (patch)
treec0b8c0263326e12fb07583168f1374981c3a98ab /src/simplewallet/simplewallet.cpp
parentMerge pull request #358 (diff)
downloadmonero-e40cfc4e29e046bc57a5995cfd0d46022b7bf285.tar.xz
Encrypted payment IDs
A payment ID may be encrypted using the tx secret key and the receiver's public view key. The receiver can decrypt it with the tx public key and the receiver's secret view key. Using integrated addresses now cause the payment IDs to be encrypted. Payment IDs used manually are not encrypted by default, but can be encrypted using the new 'encrypt_payment_id' field in the transfer and transfer_split RPC calls. It is not possible to use an encrypted payment ID by specifying a manual simplewallet transfer/transfer_new command, though this is just a limitation due to input parsing.
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index cad83bb45..9c2396029 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -1288,6 +1288,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
std::vector<uint8_t> extra;
bool payment_id_seen = false;
+ bool encrypt_payment_id = false;
if (1 == local_args.size() % 2)
{
std::string payment_id_str = local_args.back();
@@ -1298,7 +1299,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
if(r)
{
std::string extra_nonce;
- set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id);
+ set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id, false);
r = add_extra_nonce_to_tx_extra(extra, extra_nonce);
}
@@ -1376,6 +1377,11 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
return true;
}
}
+ else
+ {
+ if (has_payment_id)
+ encrypt_payment_id = true;
+ }
if (has_payment_id) {
if (payment_id_seen && payment_id != new_payment_id) {
@@ -1386,7 +1392,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
if (!payment_id_seen)
{
std::string extra_nonce;
- set_payment_id_to_tx_extra_nonce(extra_nonce, new_payment_id);
+ set_payment_id_to_tx_extra_nonce(extra_nonce, new_payment_id, encrypt_payment_id);
bool r = add_extra_nonce_to_tx_extra(extra, extra_nonce);
if(!r)
{