diff --git a/go.sum b/go.sum index c219da8b4765320160bf03a4a663da758b7bc29c..ec54a880b8eae31b3fee9ade912cbc05fa464885 100644 --- a/go.sum +++ b/go.sum @@ -317,6 +317,7 @@ go.dedis.ch/kyber/v3 v3.0.12 h1:15d61EyBcBoFIS97kS2c/Vz4o3FR8ALnZ2ck9J/ebYM= go.dedis.ch/kyber/v3 v3.0.12/go.mod h1:kXy7p3STAurkADD+/aZcsznZGKVHEqbtmdIzvPfrs1U= go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo= go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4= +go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo= go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.0.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= diff --git a/packages/binary/valuetransfer/address/signaturescheme/bls.go b/packages/binary/valuetransfer/address/signaturescheme/bls.go index 5f77819e79a96eef89f45b673344fd1b64be566e..a17fc758a24389e8a939284e1c7d59763a6c00ec 100644 --- a/packages/binary/valuetransfer/address/signaturescheme/bls.go +++ b/packages/binary/valuetransfer/address/signaturescheme/bls.go @@ -2,14 +2,16 @@ package signaturescheme import ( "fmt" - "github.com/iotaledger/goshimmer/packages/binary/valuetransfer/address" + "math/rand" + "github.com/mr-tron/base58" "go.dedis.ch/kyber/v3" "go.dedis.ch/kyber/v3/pairing/bn256" "go.dedis.ch/kyber/v3/sign" "go.dedis.ch/kyber/v3/sign/bdn" "go.dedis.ch/kyber/v3/util/random" - "math/rand" + + "github.com/iotaledger/goshimmer/packages/binary/valuetransfer/address" ) // BLS implements BLS signature scheme which is robust against rogue public key attacks, or BDN @@ -19,7 +21,6 @@ import ( // This package doesn't implement any threshold signature related primitives. // it only contains what is needed for the node to check validity of the BLS signatures against addresses // and also minimum signing required for testing - var suite = bn256.NewSuite() const ( @@ -31,7 +32,6 @@ const ( // ---------------- implements SignatureScheme interface // blsSignatureScheme defines an interface for the key pairs of BLS signatures. - type blsSignatureScheme struct { priKey kyber.Scalar pubKey kyber.Point @@ -43,7 +43,6 @@ var rnd = random.New(rand.New(rand.NewSource(42))) // RandBLS creates a RANDOM instance of a signature scheme, that is used to sign the corresponding address. // mostly intended for testing. // only for testing: each time same sequence! - func RandBLS() SignatureScheme { ret := &blsSignatureScheme{} ret.priKey, ret.pubKey = bdn.NewKeyPair(suite, rnd) @@ -52,7 +51,6 @@ func RandBLS() SignatureScheme { // BLS creates an instance of BLS signature scheme // from given private and public keys in marshaled binary form - func BLS(priKey, pubKey []byte) (SignatureScheme, error) { if len(priKey) != BLS_PRIVATE_KEY_SIZE || len(pubKey) != BLS_PUBLIC_KEY_SIZE { return nil, fmt.Errorf("wrong key size") @@ -117,7 +115,7 @@ func BLSSignatureFromBytes(data []byte) (result *blsSignature, err error, consum consumedBytes = 0 err = nil if len(data) < BLS_FULL_SIGNATURE_SIZE { - err = fmt.Errorf("marshalled BLS signature size must be %d", BLS_FULL_SIGNATURE_SIZE) + err = fmt.Errorf("marshaled BLS signature size must be %d", BLS_FULL_SIGNATURE_SIZE) return } if data[0] != address.VERSION_BLS { diff --git a/packages/binary/valuetransfer/address/signaturescheme/bls_test.go b/packages/binary/valuetransfer/address/signaturescheme/bls_test.go index 28e1a3a78b508d3d304f2aa365eabeb696e44694..9e1a38aa85f917454ee5e2c84389c723884c021a 100644 --- a/packages/binary/valuetransfer/address/signaturescheme/bls_test.go +++ b/packages/binary/valuetransfer/address/signaturescheme/bls_test.go @@ -1,14 +1,14 @@ package signaturescheme import ( - "github.com/magiconair/properties/assert" "testing" + + "github.com/magiconair/properties/assert" ) var dataToSign = []byte("Hello Boneh-Lynn-Shacham (BLS) --> Boneh-Drijvers-Neven (BDN)") func TestBLS_base(t *testing.T) { - blsSigScheme := RandBLS() t.Logf("generating random BLS signature scheme: %s\n", blsSigScheme.(*blsSignatureScheme).String()) signature := blsSigScheme.Sign(dataToSign)