diff --git a/cmd/neofs-rest-gw/integration_test.go b/cmd/neofs-rest-gw/integration_test.go index 73246f6..79206b0 100644 --- a/cmd/neofs-rest-gw/integration_test.go +++ b/cmd/neofs-rest-gw/integration_test.go @@ -3,10 +3,6 @@ package main import ( "bytes" "context" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/sha512" "encoding/base64" "encoding/hex" "encoding/json" @@ -1061,10 +1057,9 @@ func makeAuthTokenRequest(ctx context.Context, t *testing.T, bearers []*models.B } func signToken(t *testing.T, key *keys.PrivateKey, data []byte) *handlers.BearerToken { - h := sha512.Sum512(data) - x, y, err := ecdsa.Sign(rand.Reader, &key.PrivateKey, h[:]) + signer := neofsecdsa.Signer(key.PrivateKey) + sign, err := signer.Sign(data) require.NoError(t, err) - sign := elliptic.Marshal(elliptic.P256(), x, y) return &handlers.BearerToken{ Token: base64.StdEncoding.EncodeToString(data), diff --git a/handlers/auth_test.go b/handlers/auth_test.go index ebc2c98..ae953fb 100644 --- a/handlers/auth_test.go +++ b/handlers/auth_test.go @@ -2,9 +2,6 @@ package handlers import ( "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/sha512" "encoding/base64" "encoding/hex" "math" @@ -12,6 +9,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-api-go/v2/acl" + crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-rest-gw/gen/models" "github.com/nspcc-dev/neofs-rest-gw/internal/util" "github.com/nspcc-dev/neofs-sdk-go/user" @@ -54,12 +52,8 @@ func TestSign(t *testing.T) { binaryBearer := v2token.GetBody().StableMarshal(nil) bearerBase64 := base64.StdEncoding.EncodeToString(binaryBearer) - h := sha512.Sum512(binaryBearer) - x, y, err := ecdsa.Sign(rand.Reader, &key.PrivateKey, h[:]) - if err != nil { - panic(err) - } - signatureData := elliptic.Marshal(elliptic.P256(), x, y) + signatureData, err := crypto.Sign(&key.PrivateKey, binaryBearer) + require.NoError(t, err) bt := &BearerToken{ Token: bearerBase64,