aboutsummaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
Diffstat (limited to 'go')
-rw-r--r--go/bls/bls.go9
-rw-r--r--go/main.go10
2 files changed, 19 insertions, 0 deletions
diff --git a/go/bls/bls.go b/go/bls/bls.go
index 2f7e8ca..976c884 100644
--- a/go/bls/bls.go
+++ b/go/bls/bls.go
@@ -166,6 +166,12 @@ func (sec *SecretKey) Recover(secVec []SecretKey, idVec []Id) {
C.blsSecretKeyRecover(sec.self, (**C.blsSecretKey)(unsafe.Pointer(&sv[0])), (**C.blsId)(unsafe.Pointer(&iv[0])), C.size_t(len(secVec)))
}
+func (sec *SecretKey) GetPop() (sign *Sign) {
+ sign = NewSign()
+ C.blsSecretKeyGetPop(sec.self, sign.self)
+ return sign
+}
+
type PublicKey struct {
self *C.blsPublicKey
}
@@ -273,3 +279,6 @@ func (sign *Sign) Verify(pub *PublicKey, m string) bool {
return C.blsSignVerify(sign.self, pub.self, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))) == 1
}
+func (sign *Sign) VerifyPop(pub *PublicKey) bool {
+ return C.blsSignVerifyPop(sign.self, pub.self) == 1;
+}
diff --git a/go/main.go b/go/main.go
index 956b8b2..1ad8cc1 100644
--- a/go/main.go
+++ b/go/main.go
@@ -104,6 +104,15 @@ func testAdd() {
verifyTrue(sign1.Verify(pub1, m))
}
+func testPop() {
+ fmt.Println("testPop")
+ sec := bls.NewSecretKey()
+ sec.Init()
+ pop := sec.GetPop()
+ verifyTrue(pop.VerifyPop(sec.GetPublicKey()))
+ sec.Init()
+ verifyTrue(!pop.VerifyPop(sec.GetPublicKey()))
+}
func main() {
fmt.Println("init")
bls.Init()
@@ -145,4 +154,5 @@ func main() {
testRecoverSecretKey()
testAdd()
testSign()
+ testPop()
}