summaryrefslogtreecommitdiff
path: root/xed25519.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-02-10 23:08:14 -0500
committerGitHub <noreply@github.com>2019-02-10 23:08:14 -0500
commit0ca4c41a9780814de19b997f1635668781dd5fdb (patch)
tree88a6e132c17f01b8b1d8945abb94defce66ad482 /xed25519.h
parent1c6a96a57eadef520af26c61afc43e8aba6da910 (diff)
downloadcryptopp-git-0ca4c41a9780814de19b997f1635668781dd5fdb.tar.gz
Add ed25519 SignStream and VerifyStream functions (GH #796, PR #797)
Diffstat (limited to 'xed25519.h')
-rw-r--r--xed25519.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/xed25519.h b/xed25519.h
index 363d7d7c..f581a586 100644
--- a/xed25519.h
+++ b/xed25519.h
@@ -574,6 +574,18 @@ struct ed25519Signer : public PK_Signer
size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const;
+ /// \brief Sign a stream
+ /// \param rng a RandomNumberGenerator derived class
+ /// \param stream an std::istream derived class
+ /// \param signature a block of bytes for the signature
+ /// \return actual signature length
+ /// \details SignStream() handles large streams. It was added for signing and verifying
+ /// files that are too large for a memory allocation.
+ /// \details ed25519 is a determinsitic signature scheme. <tt>IsProbabilistic()</tt>
+ /// returns false and the random number generator can be <tt>NullRNG()</tt>.
+ /// \pre <tt>COUNTOF(signature) == MaxSignatureLength()</tt>
+ size_t SignStream (RandomNumberGenerator &rng, std::istream& stream, byte *signature) const;
+
protected:
ed25519PrivateKey m_key;
};
@@ -742,6 +754,15 @@ struct ed25519Verifier : public PK_Verifier
bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const;
+ /// \brief Check whether input signature is a valid signature for input message
+ /// \param stream an std::istream derived class
+ /// \param signature a pointer to the signature over the message
+ /// \param signatureLen the size of the signature
+ /// \return true if the signature is valid, false otherwise
+ /// \details VerifyStream() handles large streams. It was added for signing and verifying
+ /// files that are too large for a memory allocation.
+ bool VerifyStream(std::istream& stream, const byte *signature, size_t signatureLen) const;
+
DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const {
CRYPTOPP_UNUSED(recoveredMessage); CRYPTOPP_UNUSED(messageAccumulator);
throw NotImplemented("ed25519Verifier: this object does not support recoverable messages");