pallet-cosmwasm::crypto::do_secp256k1_verify()
fails for signatures with recovery ID 1
#4500
Labels
pallet-cosmwasm::crypto::do_secp256k1_verify()
fails for signatures with recovery ID 1
#4500
Description
The current implementation of
do_secp256k1_verify()
adds a dummy byte0x00
to the end of the secp256k1 signature to convert a 64-byte signature to a 65-byte Substrate ECDSA signature.For verifying a secp256k1 signature, the recovery ID is not needed when the public key is known. However,
sp_io::crypto::ecdsa_verify_prehashed()
internally recovers a public key from the signature, so it doesn't work as expected.conr2d@49efc1a
In the attached example, the newly added test
secp256k1_recover_pubkey_recovers()
shows the given signature is valid, but it causessecp256k1_verify_verifies()
to fail.Possible Solutions
sp_io::crypto::ecdsa_verify_prehashed()
.If you would like, I can submit a pull request to resolve this issue.
The text was updated successfully, but these errors were encountered: