From c4effc078b4f034d8b7d46b028e3345091ee1612 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 6 Feb 2024 16:17:32 -0500 Subject: [PATCH] Remove some no-longer-needed x/crypto refs (#4371) --- internal/auth/ldap/testing_test.go | 2 +- internal/server/repository_workerauth_test.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/auth/ldap/testing_test.go b/internal/auth/ldap/testing_test.go index 075cbb18f0..0b386aff3f 100644 --- a/internal/auth/ldap/testing_test.go +++ b/internal/auth/ldap/testing_test.go @@ -5,6 +5,7 @@ package ldap import ( "context" + "crypto/ed25519" "crypto/rand" "crypto/x509" "testing" @@ -14,7 +15,6 @@ import ( "github.com/hashicorp/boundary/internal/kms" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/crypto/ed25519" ) func Test_testAuthMethod(t *testing.T) { diff --git a/internal/server/repository_workerauth_test.go b/internal/server/repository_workerauth_test.go index aaaf9e4cdf..97295a5b7a 100644 --- a/internal/server/repository_workerauth_test.go +++ b/internal/server/repository_workerauth_test.go @@ -5,6 +5,7 @@ package server import ( "context" + "crypto/ecdh" "crypto/hmac" "crypto/rand" "crypto/sha256" @@ -30,7 +31,6 @@ import ( "github.com/mr-tron/base58" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/crypto/curve25519" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/structpb" ) @@ -177,8 +177,9 @@ func TestStoreWorkerAuth(t *testing.T) { require.NoError(err) keyId, err := nodeenrollment.KeyIdFromPkix(nodeCreds.CertificatePublicKeyPkix) require.NoError(err) - nodePubKey, err := curve25519.X25519(nodeCreds.EncryptionPrivateKeyBytes, curve25519.Basepoint) + privKey, err := ecdh.X25519().NewPrivateKey(nodeCreds.EncryptionPrivateKeyBytes) require.NoError(err) + nodePubKey := privKey.PublicKey().Bytes() // Add in node information to storage so we have a key to use nodeInfo := &types.NodeInformation{ @@ -336,8 +337,9 @@ func TestStoreNodeInformationTx(t *testing.T) { nodeCreds, err := types.NewNodeCredentials(testCtx, storage) require.NoError(t, err) - nodePubKey, err := curve25519.X25519(nodeCreds.EncryptionPrivateKeyBytes, curve25519.Basepoint) + privKey, err := ecdh.X25519().NewPrivateKey(nodeCreds.EncryptionPrivateKeyBytes) require.NoError(t, err) + nodePubKey := privKey.PublicKey().Bytes() // Add in node information to storage so we have a key to use nodeInfo := &types.NodeInformation{ Id: testKeyId, @@ -572,8 +574,9 @@ func TestStoreNodeInformationTx_Twice(t *testing.T) { nodeCreds, err := types.NewNodeCredentials(testCtx, storage) require.NoError(t, err) - nodePubKey, err := curve25519.X25519(nodeCreds.EncryptionPrivateKeyBytes, curve25519.Basepoint) + privKey, err := ecdh.X25519().NewPrivateKey(nodeCreds.EncryptionPrivateKeyBytes) require.NoError(t, err) + nodePubKey := privKey.PublicKey().Bytes() // Add in node information to storage so we have a key to use nodeInfo := &types.NodeInformation{ Id: testKeyId, @@ -594,8 +597,9 @@ func TestStoreNodeInformationTx_Twice(t *testing.T) { nodeCreds, err := types.NewNodeCredentials(testCtx, storage) require.NoError(t, err) - nodePubKey, err := curve25519.X25519(nodeCreds.EncryptionPrivateKeyBytes, curve25519.Basepoint) + privKey, err := ecdh.X25519().NewPrivateKey(nodeCreds.EncryptionPrivateKeyBytes) require.NoError(t, err) + nodePubKey := privKey.PublicKey().Bytes() // Add in node information to storage so we have a key to use nodeInfo := &types.NodeInformation{ Id: "fake-secondary-key-id",