Hi Kanis, > a %= p; b %= p; x %= p; y %= p; > ...I had commented out makes it work This was an issue when I developed the original code. If you noticed, ECB would generate negative values at times for the points. In a personal correspondence, Marcel (the author of ECB) stated it was not required.
However, per Certicom, the domain parameters are in the interval [0, p-1]. So I brought the parameters in line with Certicom's requirement. Reference SEC 1: Elliptic Curve Cryptography. Section 3.1.1.1, Elliptic Curve Domain Parameters over Fp Generation Primitive. I apologize it caused you grief. Jeff On 9/21/07, kanis <[EMAIL PROTECTED]> wrote: > > Well, I figured out that adding "a %= p; b %= p; x %= p; y %= p;" to > my source code after the curve I had commented out makes it work (idea > from > http://www.codeproject.com/cpp/ECIESProductKey.asp?df=100&forumid=359069&exp=0&select=1780315). > > But what worries me is that even though it looks like it's working, > signer.GetKey().GetPrivateExponent() returns 1, which seems > suspicious, because if I use the standard ASN1::secp112r1() curve, > signer.GetKey().GetPrivateExponent() returns a huge number. Can > anyone explain why this would be or what the Private Exponent is > supposed to represent (appears to be the value of h)? > > Actually, if I just replace h with x in the call to Initialize, it > still seems to work and I get x back from the call to > signer.GetKey().GetPrivateExponent(). But x is already used in the > point G, so... what is h for? This is so confusing. > > Here's the new top part of the source code: > > CryptoPP::Integer p("147088164709569533"); > CryptoPP::Integer a("6094329446842148"); > CryptoPP::Integer b("-57162508610850246"); > CryptoPP::Integer n("147088163948218061"); // R from ECB > CryptoPP::Integer h("1"); // S from ECB, must be > <= 4 > CryptoPP::Integer x("71002669261090523"); > CryptoPP::Integer y("11469141678568184"); > a %= p; b %= p; x %= p; y %= p; > > CryptoPP::ECP ec( p, a, b ); > CryptoPP::ECP::Point G( x, y ); > CryptoPP::ECDSA< CryptoPP::ECP >::PrivateKey PrivateKey; > PrivateKey.Initialize( ec, G, n, h ); > > CryptoPP::ECDSA< CryptoPP::ECP >::Signer signer(PrivateKey); > std::cout << "Private Key x = " << > signer.GetKey().GetPrivateExponent() << "\r\n"; > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
