diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-11 14:14:23 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-08-11 14:14:23 +0800 |
commit | 6ab490cb6ae5321c991b9ce24c2b2f908d8c3490 (patch) | |
tree | 5033e8f9a029b3e9c61ddf015e8a1f6b296313c6 /include | |
parent | 0ed60fb7254d28bc682feb3150ea1e3df79b2b77 (diff) | |
download | dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.tar dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.tar.gz dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.tar.bz2 dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.tar.lz dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.tar.xz dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.tar.zst dexon-bls-6ab490cb6ae5321c991b9ce24c2b2f908d8c3490.zip |
add Feldman VSS ; Verifier
Diffstat (limited to 'include')
-rw-r--r-- | include/bls.hpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/bls.hpp b/include/bls.hpp index 82378be..fc29d5c 100644 --- a/include/bls.hpp +++ b/include/bls.hpp @@ -17,6 +17,7 @@ namespace impl { struct PublicKey; struct PrivateKey; struct Sign; +struct Verifier; } // bls::impl @@ -48,6 +49,24 @@ public: void recover(const std::vector<Sign>& signVec); }; +/* + Feldman's verifiable secret sharing +*/ +class Verifier { + impl::Verifier *self_; + friend class PrivateKey; + friend class PublicKey; +public: + Verifier(); + ~Verifier(); + Verifier(const Verifier& rhs); + Verifier& operator=(const Verifier& rhs); + bool operator==(const Verifier& rhs) const; + bool operator!=(const Verifier& rhs) const { return !(*this == rhs); } + friend std::ostream& operator<<(std::ostream& os, const Verifier& ver); + friend std::istream& operator>>(std::istream& is, Verifier& ver); +}; + class PublicKey { impl::PublicKey *self_; int id_; @@ -71,6 +90,10 @@ public: recover publicKey from k pubVec */ void recover(const std::vector<PublicKey>& pubVec); + /* + validate self by Verifier + */ + bool isValid(const Verifier& ver) const; }; class PrivateKey { @@ -95,8 +118,9 @@ public: void sign(Sign& sign, const std::string& m) const; /* k-out-of-n secret sharing of privateKey + set verifier if ver is not 0 */ - void share(std::vector<PrivateKey>& prvVec, int n, int k); + void share(std::vector<PrivateKey>& prvVec, int n, int k, Verifier *ver = 0); /* recover privateKey from k prvVec */ |