diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-03 21:15:10 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-09 10:13:41 +0100 |
commit | e40cfc4e29e046bc57a5995cfd0d46022b7bf285 (patch) | |
tree | c0b8c0263326e12fb07583168f1374981c3a98ab /src/wallet/wallet_rpc_server.cpp | |
parent | Merge pull request #358 (diff) | |
download | monero-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 '')
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 1d38695ae..4797f76a2 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -117,7 +117,7 @@ namespace tools } //------------------------------------------------------------------------------------------------------------------------------ - bool wallet_rpc_server::validate_transfer(const std::list<wallet_rpc::transfer_destination> destinations, std::string payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, epee::json_rpc::error& er) + bool wallet_rpc_server::validate_transfer(const std::list<wallet_rpc::transfer_destination> destinations, std::string payment_id, bool encrypt_payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, epee::json_rpc::error& er) { crypto::hash integrated_payment_id = cryptonote::null_hash; for (auto it = destinations.begin(); it != destinations.end(); it++) @@ -144,6 +144,9 @@ namespace tools } integrated_payment_id = new_payment_id; } + + // integrated addresses imply encrypted payment id + encrypt_payment_id = true; } if (!payment_id.empty()) @@ -161,7 +164,7 @@ namespace tools } std::string extra_nonce; - cryptonote::set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id); + cryptonote::set_payment_id_to_tx_extra_nonce(extra_nonce, payment_id, encrypt_payment_id); /* Append Payment ID data into extra */ if (!cryptonote::add_extra_nonce_to_tx_extra(extra, extra_nonce)) { @@ -189,7 +192,7 @@ namespace tools } // validate the transfer requested and populate dsts & extra - if (!validate_transfer(req.destinations, req.payment_id, dsts, extra, er)) + if (!validate_transfer(req.destinations, req.payment_id, req.encrypt_payment_id, dsts, extra, er)) { return false; } @@ -247,7 +250,7 @@ namespace tools } // validate the transfer requested and populate dsts & extra; RPC_TRANSFER::request and RPC_TRANSFER_SPLIT::request are identical types. - if (!validate_transfer(req.destinations, req.payment_id, dsts, extra, er)) + if (!validate_transfer(req.destinations, req.payment_id, req.encrypt_payment_id, dsts, extra, er)) { return false; } |