tendermint-rs icon indicating copy to clipboard operation
tendermint-rs copied to clipboard

Refactor public keys

Open xla opened this issue 3 years ago • 0 comments

What you got in mind for this? Worth capturing in a follow-up issue?

Yeah, probably.

I think it'd be good to switch to using the k256::PublicKey or k256::ecdsa::VerifyingKey types as the tendermint::public_key::Secp256k1 key type.

Those types ensure that the public key represents a valid elliptic curve point. It's presently using an EncodedPoint type which represents a SEC1 serialization of an elliptic curve point that isn't guaranteed to be valid.

One drawback of this approach is that tendermint::PublicKey::as_bytes() couldn't exist in its current form, since the k256 types represent a decoded curve point and require an extra step to re-serialize them.

Originally posted by @tarcieri in https://github.com/informalsystems/tendermint-rs/issues/872#issuecomment-830206219

xla avatar Apr 30 '21 16:04 xla