aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-08-15 16:05:53 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-08-15 16:05:53 +0800
commit6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318 (patch)
tree3793e48d5db8b8cd8d9238354f4b4467d4cdd7e8 /include
parentd3d6bf8848950be1bafae4b90c8e83085b894d16 (diff)
downloaddexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.gz
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.bz2
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.lz
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.xz
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.zst
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.zip
add operator+()
Diffstat (limited to 'include')
-rw-r--r--include/bls.hpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/bls.hpp b/include/bls.hpp
index 23bff1c..0b8279a 100644
--- a/include/bls.hpp
+++ b/include/bls.hpp
@@ -49,11 +49,14 @@ public:
int getId() const { return id_; }
friend std::ostream& operator<<(std::ostream& os, const Sign& s);
friend std::istream& operator>>(std::istream& is, Sign& s);
-
/*
recover sign from k signVec
*/
void recover(const std::vector<Sign>& signVec);
+ /*
+ add signature key only if id_ == 0
+ */
+ void add(const Sign& rhs);
};
/*
@@ -106,8 +109,15 @@ public:
validate self by MasterPublicKey
*/
bool isValid(const MasterPublicKey& mpk) const;
+ /*
+ add public key only if id_ == 0
+ */
+ void add(const PublicKey& rhs);
};
+/*
+ s ; private key
+*/
class PrivateKey {
impl::PrivateKey *self_;
int id_; // master if id_ = 0, shared if id_ > 0
@@ -135,6 +145,14 @@ public:
recover privateKey from k prvVec
*/
void recover(const std::vector<PrivateKey>& prvVec);
+ /*
+ add private key only if id_ == 0
+ */
+ void add(const PrivateKey& rhs);
};
+inline Sign operator+(const Sign& a, const Sign& b) { Sign r(a); r.add(b); return r; }
+inline PublicKey operator+(const PublicKey& a, const PublicKey& b) { PublicKey r(a); r.add(b); return r; }
+inline PrivateKey operator+(const PrivateKey& a, const PrivateKey& b) { PrivateKey r(a); r.add(b); return r; }
+
} //bls