pub(super) fn verify_signature(
hashed_msg: &[u8; 32],
public_key_x_bytes: &[u8; 32],
public_key_y_bytes: &[u8; 32],
signature: &[u8; 64],
) -> Result<bool, BlackBoxResolutionError>Expand description
Verifies an ECDSA signature over the Secp256k1 elliptic curve.
This function implements ECDSA signature verification on the Secp256k1 curve
§Parameters:
hashed_msg- The 32-byte hash of the message that was signedpublic_key_x_bytes- The x-coordinate of the public key (32 bytes, big-endian)public_key_y_bytes- The y-coordinate of the public key (32 bytes, big-endian)signature- The 64-byte signature in (r, s) format, where r and s are 32 bytes each
Returns true if the signature is valid, false otherwise.
The function does not validate a signature if any of the following are true:
- The signature is not “low S” normalized per BIP 0062 to prevent malleability
- The signature components
randsis zero - The public key point is not on the Secp256k1 curve
If hashed_msg >= k256::Secp256k1::ORDER, the message hash is reduced modulo the curve
order per ECDSA specification (SEC 1, section 4.1.4).