I called the method SetPublicElement and I performed trials with both "02"
and "03", but the verification stil return error.
Code is:
int main () {
using namespace CryptoPP;
AutoSeededRandomPool rnd;
ECDSA<ECP, SHA256>::PublicKey pubKey;
HexDecoder decoder;
string compactPoint;
string message =
"4003805520500000003101001400ba749705a41d251799c60000000000000000000000000000000007d1000001029705"
"a41d99c6405d693a403ad274803ffffffc23b7743e40e11fdffffe3fe9ed073753085fffa0000000004001240000006d251a3fe2"
;
string signature =
"26413d411d233adc8baf8d4401036ffd511ed996d862ce4e106275d9851339d7";
compactPoint = "02"
"937120662418500f3ad7c892b1db7e7c2d85ec48c74e99d64dcb7083082bb4f3";
//compactPoint = "03"
"937120662418500f3ad7c892b1db7e7c2d85ec48c74e99d64dcb7083082bb4f3";
pubKey.AccessGroupParameters().Initialize(ASN1::secp256r1());
StringSource ss (compactPoint, true, new CryptoPP::HexDecoder);
ECP::Point point;
pubKey.GetGroupParameters().GetCurve().DecodePoint (point, ss, ss.
MaxRetrievable());
std::cout << "Result after decompression X: " << std::hex << point.x <<
std::endl;
std::cout << "Result after decompression Y: " << std::hex << point.y <<
std::endl;
pubKey.SetPublicElement (point);
cout << "Is valid? " << pubKey.Validate (rnd, 3) << std::endl;
cout << "\n\n==================================================\n
==================================================\n";
ECDSA<ECP,SHA256>::Verifier verifier(pubKey);
bool result;
StringSource ss1( signature+message, true, new
SignatureVerificationFilter (verifier,new ArraySink( (byte*)&result, sizeof
(result))));
// Verification failure?
if (!result)
cout << "Error on verify: " << result << endl << endl;
else
cout << "Success on verify: " << result << endl << endl;
return 0;
}
What do you suggest?
--
You received this message because you are subscribed to "Crypto++ Users". More
information about Crypto++ and this group is available at
http://www.cryptopp.com and
http://groups.google.com/forum/#!forum/cryptopp-users.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.