aboutsummaryrefslogtreecommitdiffstats
path: root/ffi/go/bls/bls.go
diff options
context:
space:
mode:
Diffstat (limited to 'ffi/go/bls/bls.go')
-rw-r--r--ffi/go/bls/bls.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/ffi/go/bls/bls.go b/ffi/go/bls/bls.go
index 9b2691c..ff4f951 100644
--- a/ffi/go/bls/bls.go
+++ b/ffi/go/bls/bls.go
@@ -347,3 +347,21 @@ func HashAndMapToSignature(buf []byte) *Sign {
func VerifyPairing(X *Sign, Y *Sign, pub *PublicKey) bool {
return C.blsVerifyPairing(X.getPointer(), Y.getPointer(), pub.getPointer()) == 1
}
+
+// SignHash --
+func (sec *SecretKey) SignHash(hash []byte) (sign *Sign) {
+ sign = new(Sign)
+ // #nosec
+ err := C.blsSignHash(sign.getPointer(), sec.getPointer(), unsafe.Pointer(&hash[0]), C.size_t(len(hash)))
+ if err == 0 {
+ return sign
+ } else {
+ return nil
+ }
+}
+
+// VerifyHash --
+func (sign *Sign) VerifyHash(pub *PublicKey, hash []byte) bool {
+ // #nosec
+ return C.blsVerifyHash(sign.getPointer(), pub.getPointer(), unsafe.Pointer(&hash[0]), C.size_t(len(hash))) == 1
+}