Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions LaksaCsharp/Crypto/Schnorr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ public static bool Verify(byte[] msg, Signature sig, ECPoint publicKey)
throw new Exception("Invalid R or S value: cannot be negative.");
}

if (sig.R.CompareTo(secp256k1.Curve.Order) >= 0 || sig.S.CompareTo(secp256k1.Curve.Order) >= 0) {
throw new Exception("Invalid R or S value: must be smaller than curve order");
}

if (publicKey.Curve != (secp256k1.Curve))
{
throw new Exception("The public key must be a point on secp256k1.");
Expand Down