Skip to content

Add support for verifying ECDSA signature without recovery ID #5217

@conr2d

Description

@conr2d

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

The sp_core::ecdsa::Signature represents a recoverable ECDSA signature in a compact form (65 bytes: 64-byte signature + 1-byte recovery ID). While signature verification can be performed without the recovery ID when the associated public key is known, the current implementation of sp_core::ecdsa::Signature mandates the inclusion of the recovery ID. Specifically, sp_core::ecdsa::Pair::verify() utilizes the recover() method internally, thus preventing the verification of a 64-byte signature without the recovery ID. This feature is necessary to support signature verification for external protocols such as Cosmos SDK.

Request

Introduce a method to verify a 64-byte ECDSA signature without requiring the recovery ID.

Solution

  1. Modify sp_core::ecdsa::Pair::verify() to leverage the underlying libraries (k256 or secp256k1) to handle the verification with a 64-byte signature. In this scenario, the last byte of sp_core::ecdsa::Signature (recovery ID) will be ignored, potentially altering the function's behavior.
  2. Implement a new function, such as sp_io::crypto::secp256k1_ecdsa_verify(), that accepts a 64-byte signature, the message hash, and the public key for verification purposes.

Are you willing to help with this request?

Yes!

Metadata

Metadata

Assignees

No one assigned

    Labels

    I5-enhancementAn additional feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions