aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/crypto.h
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2017-03-30 08:22:16 +0900
committerstoffu <stoffu@protonmail.ch>2017-06-22 18:11:13 +0900
commitc9e0e944e900012b5789fd54bd8e455e399f94a0 (patch)
tree2eae9d04828d01af4ef3b1d64df535bc0ae24e06 /src/crypto/crypto.h
parentMerge pull request #2094 (diff)
downloadmonero-c9e0e944e900012b5789fd54bd8e455e399f94a0.tar.xz
Signature proving payment to destination by only revealing key derivation, not the actual tx secret key
Diffstat (limited to '')
-rw-r--r--src/crypto/crypto.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h
index 3b8c7996b..e99b6651f 100644
--- a/src/crypto/crypto.h
+++ b/src/crypto/crypto.h
@@ -123,6 +123,10 @@ namespace crypto {
friend void generate_signature(const hash &, const public_key &, const secret_key &, signature &);
static bool check_signature(const hash &, const public_key &, const signature &);
friend bool check_signature(const hash &, const public_key &, const signature &);
+ static void generate_tx_proof(const hash &, const public_key &, const public_key &, const public_key &, const secret_key &, signature &);
+ friend void generate_tx_proof(const hash &, const public_key &, const public_key &, const public_key &, const secret_key &, signature &);
+ static bool check_tx_proof(const hash &, const public_key &, const public_key &, const public_key &, const signature &);
+ friend bool check_tx_proof(const hash &, const public_key &, const public_key &, const public_key &, const signature &);
static void generate_key_image(const public_key &, const secret_key &, key_image &);
friend void generate_key_image(const public_key &, const secret_key &, key_image &);
static void generate_ring_signature(const hash &, const key_image &,
@@ -200,6 +204,16 @@ namespace crypto {
return crypto_ops::check_signature(prefix_hash, pub, sig);
}
+ /* Generation and checking of a tx proof; given a tx pubkey R, the recipient's view pubkey A, and the key
+ * derivation D, the signature proves the knowledge of the tx secret key r such that R=r*G and D=r*A
+ */
+ inline void generate_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const public_key &D, const secret_key &r, signature &sig) {
+ crypto_ops::generate_tx_proof(prefix_hash, R, A, D, r, sig);
+ }
+ inline bool check_tx_proof(const hash &prefix_hash, const public_key &R, const public_key &A, const public_key &D, const signature &sig) {
+ return crypto_ops::check_tx_proof(prefix_hash, R, A, D, sig);
+ }
+
/* To send money to a key:
* * The sender generates an ephemeral key and includes it in transaction output.
* * To spend the money, the receiver generates a key image from it.