Skip to content

S256Point.verify and Signature class in ecc.py do not issue warning if "s" value is high #297

Open
@salmonberry7

Description

@salmonberry7

When an ECDSA signature is made with this library using PrivateKey.sign it is canonicalized so the s value is low, ie. so (& see Issue #296) :

s < N // 2

where

N = order of secp256k1 generator point G =
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

N // 2 = 
7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0        (exact)

However if a signature with high s that was obtained from some other cryptography library (eg. openssl or Python ecdsa package) is verified using S256Point.verify then no warning is issued that the s value is high and needs to be replaced with N - s to be accepted by the Bitcoin network.

Likewise in the Signature class, in the constructor and the parse method, no warning is issued if the s value is high.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions