diff --git a/crypto/verificationhelper/ecdhkeys.go b/crypto/verificationhelper/ecdhkeys.go index 3298ecca..91da9b78 100644 --- a/crypto/verificationhelper/ecdhkeys.go +++ b/crypto/verificationhelper/ecdhkeys.go @@ -18,7 +18,7 @@ func (e *ECDHPrivateKey) UnmarshalJSON(data []byte) (err error) { if err != nil { return } - e.PrivateKey, err = ecdh.P256().NewPrivateKey(raw) + e.PrivateKey, err = ecdh.X25519().NewPrivateKey(raw) return err } @@ -39,7 +39,7 @@ func (e *ECDHPublicKey) UnmarshalJSON(data []byte) (err error) { if err != nil { return } - e.PublicKey, err = ecdh.P256().NewPublicKey(raw) + e.PublicKey, err = ecdh.X25519().NewPublicKey(raw) return } diff --git a/crypto/verificationhelper/ecdhkeys_test.go b/crypto/verificationhelper/ecdhkeys_test.go index 8414725f..109fbf88 100644 --- a/crypto/verificationhelper/ecdhkeys_test.go +++ b/crypto/verificationhelper/ecdhkeys_test.go @@ -13,7 +13,7 @@ import ( ) func TestECDHPrivateKey(t *testing.T) { - pk, err := ecdh.P256().GenerateKey(rand.Reader) + pk, err := ecdh.X25519().GenerateKey(rand.Reader) require.NoError(t, err) private := verificationhelper.ECDHPrivateKey{pk} marshalled, err := json.Marshal(private) @@ -29,7 +29,7 @@ func TestECDHPrivateKey(t *testing.T) { } func TestECDHPublicKey(t *testing.T) { - private, err := ecdh.P256().GenerateKey(rand.Reader) + private, err := ecdh.X25519().GenerateKey(rand.Reader) require.NoError(t, err) public := private.PublicKey() @@ -38,7 +38,7 @@ func TestECDHPublicKey(t *testing.T) { marshalled, err := json.Marshal(pub) require.NoError(t, err) - assert.Len(t, marshalled, 90) + assert.Len(t, marshalled, 46) var unmarshalled verificationhelper.ECDHPublicKey err = json.Unmarshal(marshalled, &unmarshalled)