From 49d59fc116266edbfcebcfb24576cedbb7d50247 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 8 Apr 2015 14:07:45 -0400 Subject: [PATCH] IsOnCurve added --- Signature.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Signature.cpp b/Signature.cpp index 5ea61bec..fdaeff54 100644 --- a/Signature.cpp +++ b/Signature.cpp @@ -43,6 +43,12 @@ namespace crypto return res; } + bool IsOnCurve (const CryptoPP::ECP::Point& p) + { + auto x2 = p.x.Squared(), y2 = p.y.Squared (); + return (y2 - x2 - CryptoPP::Integer::One() - d*x2*y2).Modulo (q).IsZero (); + } + private: CryptoPP::Integer b, q, l, d;