Dear all,
I am trying to write code for elliptic curve key and signature
generation.
This code is to be validated with the ANSI X9.62 standard, which has
got numeric examples of key and signature calculations for different
elliptic curves, very useful to see whether you are getting decent
answers out of your calculations.
For this purpose I would need to be able to create curves with any
desired domain parameters in order to match those curves given in
X9.62.
I have done this same job in JAVA without much problem, but I am
finding it difficult to accomplish it with Crypto++ as I can“t find
relevant classes and constructors for creating custom elliptic curves
and/or displaying their parameters on screen.
What I have written so far is the following:
#define ECC_CURVE CryptoPP::ASN1::sect163k1()
typedef CryptoPP::ECDH <CryptoPP::EC2N>::Domain ECDHDomain;
const CryptoPP::OID CURVE = ECC_CURVE;
ECDHDomain mycurve = ECDHDomain(CURVE);
dumpCurve(mycurve);
void dumpCurve ( CryptoPP::ECDH <CryptoPP::EC2N>::Domain mycurve ) {
EC2N::FieldElement A =
mycurve.GetGroupParameters().GetCurve().GetA();
EC2N::FieldElement B =
mycurve.GetGroupParameters().GetCurve().GetB();
PolynomialMod2 Gx = mycurve.GetGenerator().x;
PolynomialMod2 Gy = mycurve.GetGenerator().y;
Integer r = mycurve.GetGroupParameters().GetGroupOrder();
Integer n = mycurve.GetGroupParameters().GetSubgroupOrder();
Integer k = mycurve.GetGroupParameters().GetCofactor();
cout << "Elliptic Curve: " << endl;
cout << "\na = " << endl;
for ( int i = A.ByteCount(); i >= 0 ; i-- )
printf( "%x", A.GetByte(i) );
cout << "\nb = " << endl;
for ( int i = B.ByteCount(); i >= 0; i-- )
printf("%x", B.GetByte(i) );
cout << "\nGenerator point:\n";
cout << "Gx = \n";
for ( int i = Gx.ByteCount(); i >= 0; i-- )
printf("%x", Gx.GetByte(i) );
cout << "\nGy = \n";
for ( int i = Gy.ByteCount(); i >= 0; i-- )
printf( "%x", Gy.GetByte(i) );
cout << "\nn: " << n << endl;
cout << "r: " << r << endl;
cout << "Cofactor k: \n" << k << endl;
}
Now what I would like to do is to be able to generate my own customly
defined elliptic curve and display its name and domain parameters on
screen in an easier way... I would appreciate if anyone could provide
any further source code examples and / or advice.
Thank you very much for your cooperation.
With best regards,
Xourlingkahn
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---