Skip to content

Commit 3c6ff4f

Browse files
committed
add back augmented signing and verification methods for versioning of BLS keys
1 parent 41e7619 commit 3c6ff4f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crypt/bls.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func (priv *BLSPrivateKey) Sign(message []byte) (signature Signature, err error)
2727
return (*BLSSignature)(sig), nil
2828
}
2929

30+
func (priv *BLSPrivateKey) SignAugmented(message []byte) (signature Signature, err error) {
31+
sig := minpk.Sign((*minpk.PrivateKey)(priv), message, bls.Augmentation)
32+
return (*BLSSignature)(sig), nil
33+
}
34+
3035
func (priv *BLSPrivateKey) ProvePossession() *BLSSignature {
3136
sig := minpk.Prove((*minpk.PrivateKey)(priv))
3237
return (*BLSSignature)(sig)
@@ -89,6 +94,15 @@ func (pub *BLSPublicKey) VerifySignature(sig Signature, message []byte) bool {
8994
}
9095
}
9196

97+
func (pub *BLSPublicKey) VerifySignatureAugmented(sig Signature, message []byte) bool {
98+
switch sig := sig.(type) {
99+
case *BLSSignature:
100+
return minpk.Verify((*minpk.PublicKey)(pub), message, (*minpk.Signature)(sig), bls.Augmentation) == nil
101+
default:
102+
return false
103+
}
104+
}
105+
92106
func (pub *BLSPublicKey) MarshalText() (text []byte, err error) {
93107
return pub.ToProtocol().ToBase58(), nil
94108
}

0 commit comments

Comments
 (0)