Skip to content

Commit

Permalink
Switch to signatures on G2, Resolves #96
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
  • Loading branch information
Kubuxu committed Apr 15, 2024
1 parent c459d2a commit e7d9ffd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions blssig/aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (v Verifier) Aggregate(pubkeys []gpbft.PubKey, signatures [][]byte) ([]byte
return nil, xerrors.Errorf("converting public keys to mask: %w", err)
}

aggSigPoint, err := bdn.AggregateSignatures(v.suite, signatures, mask)
aggSigPoint, err := bdn.NewSchemeOnG2(v.suite).AggregateSignatures(signatures, mask)
if err != nil {
return nil, xerrors.Errorf("computing aggregate signature: %w", err)
}
Expand All @@ -40,7 +40,7 @@ func (v Verifier) VerifyAggregate(msg []byte, signature []byte, pubkeys []gpbft.
return xerrors.Errorf("converting public keys to mask: %w", err)
}

aggPubKey, err := bdn.AggregatePublicKeys(v.suite, mask)
aggPubKey, err := bdn.NewSchemeOnG2(v.suite).AggregatePublicKeys(mask)
if err != nil {
return xerrors.Errorf("aggregating public keys: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions blssig/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ type Signer struct {
keys map[string]kyber.Scalar
}

func SignerWithKeyOnG2() *Signer {
func SignerWithKeyOnG1() *Signer {
suite := bls12381.NewBLS12381Suite()
return &Signer{
suite: suite,
scheme: bls.NewSchemeOnG1(suite),
keyGroup: suite.G2(),
scheme: bls.NewSchemeOnG2(suite),
keyGroup: suite.G1(),
keys: make(map[string]kyber.Scalar),
}
}
Expand Down
4 changes: 2 additions & 2 deletions blssig/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import (

func TestBLSSigning(t *testing.T) {
test.NewSigningSuite(
blssig.SignerWithKeyOnG2(),
blssig.VerifierWithKeyOnG2()).Run(t)
blssig.SignerWithKeyOnG1(),
blssig.VerifierWithKeyOnG1()).Run(t)
}
4 changes: 2 additions & 2 deletions blssig/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ type Verifier struct {
keyGroup kyber.Group
}

func VerifierWithKeyOnG2() Verifier {
func VerifierWithKeyOnG1() Verifier {
suite := bls12381.NewBLS12381Suite()
return Verifier{
suite: suite,
keyGroup: suite.G2(),
keyGroup: suite.G1(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions sim/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func FakeSigningBacked() *SigningBacked {

func BLSSigningBacked() *SigningBacked {
return &SigningBacked{
Signer: blssig.SignerWithKeyOnG2(),
Verifier: blssig.VerifierWithKeyOnG2(),
Signer: blssig.SignerWithKeyOnG1(),
Verifier: blssig.VerifierWithKeyOnG1(),
}
}

Expand Down

0 comments on commit e7d9ffd

Please sign in to comment.