Are the files looking correct on disk?
I think there may be a problem with trying to use the same file as
both an Encoder and a Decoder.
Like writing to an outputstream, then READING from the OUTput
stream....
(sorry for caps)

On Jun 26, 1:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> see wei and harry' code ,and this is my code :
>                 char* seed = "1234567890";
>         char* privFilename = "Private.key";
>         char* pubFilename = "Public.key";
>
>         ECIES<ECP>::PrivateKey    PrivateKey;
>         ECIES<ECP>::PublicKey     PublicKey;
>         AutoSeededRandomPool    randomPool;
>
>         randomPool.Put((byte *)seed, strlen(seed));
>
>         PrivateKey.Initialize(randomPool, ASN1::secp160k1());
>         PrivateKey.MakePublicKey(PublicKey);
>
>         //save private and public exponent
>         HexEncoder privFile(new FileSink(privFilename));
>         HexEncoder pubFile(new FileSink(pubFilename));
>
>         PrivateKey.GetPrivateExponent().DEREncode(privFile);
>         PublicKey.GetGroupParameters().GetCurve().EncodePoint(pubFile,
> PublicKey.GetPublicElement(), true);
>
>         //load private and public element
>         Integer x;
>         x.BERDecode(privFile);
>         PrivateKey.AccessGroupParameters().Initialize(ASN1::secp160k1());
>         PrivateKey.SetPrivateExponent(x);
>
>         ECP::Point p;
>         PublicKey.AccessGroupParameters().Initialize(ASN1::secp160k1());
>         PublicKey.GetGroupParameters().GetCurve().DecodePoint(p,
> pubFile,  ?);
>         PublicKey.GetGroupParameters().GetCurve().EncodedPointSize(true);
>         PublicKey.SetPublicElement(p);
> when run the code, the file private.key and public.key is null, who
> can help me?
> best regards!


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