Add get_esk() function to Sapling note encryption.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include "zcash/prf.h"
|
#include "zcash/prf.h"
|
||||||
#include "zcash/Address.hpp"
|
#include "zcash/Address.hpp"
|
||||||
#include "crypto/sha256.h"
|
#include "crypto/sha256.h"
|
||||||
|
#include "librustzcash.h"
|
||||||
|
|
||||||
class TestNoteDecryption : public ZCNoteDecryption {
|
class TestNoteDecryption : public ZCNoteDecryption {
|
||||||
public:
|
public:
|
||||||
@@ -52,6 +53,12 @@ TEST(noteencryption, sapling_api)
|
|||||||
message
|
message
|
||||||
);
|
);
|
||||||
auto epk_1 = enc.get_epk();
|
auto epk_1 = enc.get_epk();
|
||||||
|
{
|
||||||
|
uint256 test_epk;
|
||||||
|
uint256 test_esk = enc.get_esk();
|
||||||
|
ASSERT_TRUE(librustzcash_sapling_ka_derivepublic(pk_1.d.begin(), test_esk.begin(), test_epk.begin()));
|
||||||
|
ASSERT_TRUE(test_epk == epk_1);
|
||||||
|
}
|
||||||
auto cv_1 = random_uint256();
|
auto cv_1 = random_uint256();
|
||||||
auto cm_1 = random_uint256();
|
auto cm_1 = random_uint256();
|
||||||
auto out_ciphertext_1 = enc.encrypt_to_ourselves(
|
auto out_ciphertext_1 = enc.encrypt_to_ourselves(
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ public:
|
|||||||
uint256 get_epk() const {
|
uint256 get_epk() const {
|
||||||
return epk;
|
return epk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint256 get_esk() const {
|
||||||
|
return esk;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Attempts to decrypt a Sapling note. This will not check that the contents
|
// Attempts to decrypt a Sapling note. This will not check that the contents
|
||||||
|
|||||||
Reference in New Issue
Block a user