On Dec 6, 1:09 pm, Mohammed Faisal <[email protected]> wrote:
>  Dear all
> I want to load private and public element but there is  run time error
> at this code ( x.DERDecode(privFile);  )
>
> How can I solve this Error.
>
> char* privFilename = "Private.key";
>   char* pubFilename = "Publicw.key";
>
>  CryptoPP::HexEncoder privFile(new CryptoPP::FileSink(privFilename));
>  CryptoPP::HexEncoder pubFile(new
> CryptoPP::FileSink(pubFilename));
>
>  PrivateKey.GetPrivateExponent().DEREncode(privFile);
>
> PublicKey.GetGroupParameters().GetCurve().EncodePoint(pubFile,PublicKey.GetPublicElement(),
> true);
>
>          CryptoPP::Integer x;
>            x.DERDecode(privFile);
>
> PrivateKey.AccessGroupParameters().Initialize(CryptoPP::ASN1::secp160r2());
>         PrivateKey.SetPrivateExponent(x);
>
>        CryptoPP::ECP::Point p;
>
> PublicKey.AccessGroupParameters().Initialize(CryptoPP::ASN1::secp160r2());
>         PublicKey.GetGroupParameters().GetCurve().DecodePoint (p,
> pubFile,48);
>
> PublicKey.GetGroupParameters().GetCurve().EncodedPointSize(true);
>         PublicKey.SetPublicElement(p);
http://www.cryptopp.com/wiki/Keys_and_Formats might be useful.

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