Decryption and tests of note/outgoing encryption.

This commit is contained in:
Sean Bowe
2018-07-16 18:34:14 -06:00
parent 34bf166e5f
commit f23e783600
3 changed files with 157 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ public:
) const;
};
typedef std::pair<std::reference_wrapper<const SaplingEncCiphertext>, std::reference_wrapper<const SaplingNoteEncryption>> SaplingNotePlaintextEncryptionResult;
typedef std::pair<SaplingEncCiphertext, SaplingNoteEncryption> SaplingNotePlaintextEncryptionResult;
class SaplingNotePlaintext : public BaseNotePlaintext {
public:
@@ -127,6 +127,12 @@ public:
SaplingNotePlaintext(const SaplingNote& note, std::array<unsigned char, ZC_MEMO_SIZE> memo);
static boost::optional<SaplingNotePlaintext> decrypt(
const SaplingEncCiphertext &ciphertext,
const uint256 &ivk,
const uint256 &epk
);
boost::optional<SaplingNote> note(const SaplingIncomingViewingKey& ivk) const;
virtual ~SaplingNotePlaintext() {}
@@ -169,6 +175,14 @@ public:
READWRITE(esk); // 8 bytes
}
static boost::optional<SaplingOutgoingPlaintext> decrypt(
const SaplingOutCiphertext &ciphertext,
const uint256& ovk,
const uint256& cv,
const uint256& cm,
const uint256& epk
);
SaplingOutCiphertext encrypt(
const uint256& ovk,
const uint256& cv,