I save and load the compressed version of EC keys in BaseEncoded form:
void Security::SavePublicKeyinFile (string pub){ //pub--> name of the file
to be saved
Base64Encoder pubkeysink(new FileSink(pub.c_str()));
publicKey.GetGroupParameters().GetCurve().EncodePoint(pubkeysink,publicKey.GetPublicElement(),true);
pubkeysink.MessageEnd(); // Need to flush Base64Encoders buffer
}
void Security::LoadPublicKeyfromFile (ECDSA<ECP, SHA1>::PublicKey
&SubjectPublicKey, char* pub){ //pub--> name of the file to be loaded
FileSource pubSrc(pub, true, new Base64Decoder);
ECP::Point pp;
SubjectPublicKey.AccessGroupParameters().Initialize(CryptoPP::ASN1::secp224r1());
SubjectPublicKey.GetGroupParameters().GetCurve().DecodePoint(pp,pubSrc,SubjectPublicKey.GetGroupParameters().GetCurve().EncodedPointSize(true));
SubjectPublicKey.SetPublicElement(pp);
}
/Amin
--
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.