diff --git a/go.mod b/go.mod index 616a92f..35873b6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ module github.com/trustbloc/sidetree-go require ( - github.com/btcsuite/btcd v0.22.3 + github.com/btcsuite/btcd/btcec/v2 v2.1.3 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/evanphx/json-patch v4.1.0+incompatible github.com/multiformats/go-multibase v0.0.1 @@ -18,6 +18,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/kr/text v0.2.0 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect diff --git a/go.sum b/go.sum index 7bebc5d..513036b 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,7 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg= -github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJkgl+MTE= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= @@ -18,6 +16,9 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc= github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= diff --git a/pkg/jwsutil/jwk.go b/pkg/jwsutil/jwk.go index 4a2f114..6d11511 100644 --- a/pkg/jwsutil/jwk.go +++ b/pkg/jwsutil/jwk.go @@ -16,7 +16,7 @@ import ( "math/big" "strings" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" "github.com/square/go-jose/v3" "github.com/square/go-jose/v3/json" "golang.org/x/crypto/ed25519" @@ -47,12 +47,13 @@ func (j *JWK) PublicKeyBytes() ([]byte, error) { ecPubKey = &j.Key.(*ecdsa.PrivateKey).PublicKey } - pubKey := &btcec.PublicKey{ - Curve: btcec.S256(), - X: ecPubKey.X, - Y: ecPubKey.Y, - } + x := &btcec.FieldVal{} + x.SetByteSlice(ecPubKey.X.Bytes()) + + y := &btcec.FieldVal{} + y.SetByteSlice(ecPubKey.Y.Bytes()) + pubKey := btcec.NewPublicKey(x, y) return pubKey.SerializeCompressed(), nil } diff --git a/pkg/jwsutil/jwk_test.go b/pkg/jwsutil/jwk_test.go index dc23861..55caa52 100644 --- a/pkg/jwsutil/jwk_test.go +++ b/pkg/jwsutil/jwk_test.go @@ -12,7 +12,7 @@ import ( "crypto/rand" "testing" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" "github.com/square/go-jose/v3" "github.com/square/go-jose/v3/json" "github.com/stretchr/testify/require" diff --git a/pkg/jwsutil/signature.go b/pkg/jwsutil/signature.go index 6a3b6a9..3cf971e 100644 --- a/pkg/jwsutil/signature.go +++ b/pkg/jwsutil/signature.go @@ -16,7 +16,7 @@ import ( "fmt" "math/big" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" "github.com/trustbloc/sidetree-go/pkg/jws" ) diff --git a/pkg/jwsutil/signature_test.go b/pkg/jwsutil/signature_test.go index 5677da5..a7bb237 100644 --- a/pkg/jwsutil/signature_test.go +++ b/pkg/jwsutil/signature_test.go @@ -16,7 +16,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" gojose "github.com/square/go-jose/v3" "github.com/square/go-jose/v3/json" "github.com/stretchr/testify/require" diff --git a/pkg/util/ecsigner/signer.go b/pkg/util/ecsigner/signer.go index 7de90b5..76d5abc 100644 --- a/pkg/util/ecsigner/signer.go +++ b/pkg/util/ecsigner/signer.go @@ -13,7 +13,7 @@ import ( "crypto/rand" "errors" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" "github.com/trustbloc/sidetree-go/pkg/jws" ) diff --git a/pkg/util/ecsigner/signer_test.go b/pkg/util/ecsigner/signer_test.go index 3cab753..af77a23 100644 --- a/pkg/util/ecsigner/signer_test.go +++ b/pkg/util/ecsigner/signer_test.go @@ -12,7 +12,7 @@ import ( "crypto/rand" "testing" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" "github.com/stretchr/testify/require" ) diff --git a/pkg/util/pubkey/jwk.go b/pkg/util/pubkey/jwk.go index 9a1231c..5f63b4b 100644 --- a/pkg/util/pubkey/jwk.go +++ b/pkg/util/pubkey/jwk.go @@ -13,7 +13,7 @@ import ( "fmt" "reflect" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" gojose "github.com/square/go-jose/v3" "github.com/square/go-jose/v3/json" diff --git a/pkg/util/pubkey/jwk_test.go b/pkg/util/pubkey/jwk_test.go index 8846402..bc85ff0 100644 --- a/pkg/util/pubkey/jwk_test.go +++ b/pkg/util/pubkey/jwk_test.go @@ -13,7 +13,7 @@ import ( "crypto/rand" "testing" - "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/btcec/v2" "github.com/stretchr/testify/require" )