> 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.
>   
Not exactly what you need, but that's what I use to generate private 
keys with custom curves defined by output of Schoof's Algorithm 
implementation
(schoof.exe, http://www.shamus.ie/index.php?page=elliptic-curves)

Generating a curve:
schoof.exe -o out.txt -h -d -s [P] [A] [B]
(P, A, B are your input parameters)

Output file format will be

size
P
A
B
N
X
Y

G is a point on a curve, CryptoPP (ECP::Point) expects it in this form: 
"04[X][Y]"


First a helper class, to convert hex strings into more C++ friendly types:

struct EcCustomParameters
{
    EcCustomParameters(const char* p, const char* a, const char* b, 
const char* g, const char* n, unsigned int k)
    {
        StringSource ssP(p, true, new HexDecoder);
        StringSource ssA(a, true, new HexDecoder);
        StringSource ssB(b, true, new HexDecoder);

        curve = ECP(Integer(ssP, (size_t)ssP.MaxRetrievable()), 
ECP::FieldElement(ssA, (size_t)ssA.MaxRetrievable()), 
ECP::FieldElement(ssB, (size_t)ssB.MaxRetrievable()));

        StringSource ssN(n, true, new HexDecoder);
        N.Decode(ssN, (size_t)ssN.MaxRetrievable());

        StringSource ssG(g, true, new HexDecoder);
        curve.DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable());

        K = k;
    }

    Integer N, K;
    ECP curve;
    ECP::Point G;
};

Then defining domain parameters:

EcCustomParameters p("PPP", "AAA", "BBB", "04XXXYYY", "NNN", 1);

Then creating CryptoPP domain parameters:

DL_GroupParameters_EC<ECP> params(p.curve, p.G, p.N, p.K);

Then generating private key:

ECIES<ECP>::PrivateKey key;
key.Initialize(rng, params);

I'm sure you can use similar approach for EC2N.


--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to