diff --git a/pkg/crypto/crypto.go b/pkg/crypto/crypto.go index 6cc09a7ec45..b5c4a3e2129 100644 --- a/pkg/crypto/crypto.go +++ b/pkg/crypto/crypto.go @@ -116,7 +116,7 @@ func NewEthereumAddress(p ecdsa.PublicKey) ([]byte, error) { if p.X == nil || p.Y == nil { return nil, errors.New("invalid public key") } - pubBytes, _ := p.ECDH() // elliptic.Marshal(btcec.S256(), p.X, p.Y) + pubBytes, _ := p.ECDH() pubHash, err := LegacyKeccak256(pubBytes.Bytes()[1:]) if err != nil { return nil, err diff --git a/pkg/keystore/file/key.go b/pkg/keystore/file/key.go index fbec230f942..a37f16a5db1 100644 --- a/pkg/keystore/file/key.go +++ b/pkg/keystore/file/key.go @@ -83,7 +83,8 @@ func encryptKey(k *ecdsa.PrivateKey, password string, edg keystore.EDG) ([]byte, } addr = a case elliptic.P256(): - addr = elliptic.Marshal(elliptic.P256(), k.PublicKey.X, k.PublicKey.Y) + pubBytes, _ := k.ECDH() + addr = pubBytes.Bytes() default: return nil, fmt.Errorf("unsupported curve: %v", k.PublicKey.Curve) }