> Could you guys be kind enough to let me know how one would initialize
> the Verifier in the validation application in a way no private
> exponent is required?
>
> The following code example is in fact working for both signing and
> verifying but I need to use AssignFrom which imply using the private
> key!
Not sure this is exactly what you need, but I just export the whole
public key, with group parameters and everything (those are bits and
pieces from my code, so don't expect it to compile :)). It is in fact
quite big, so if size matters you'll have to find another way. Those 3
blocks of code are supposedly different binaries. Hope that helps.
// Generating private/public pair
AutoSeededRandomPool rng;
ECIES<ECP>::PrivateKey privateKey;
privateKey.Initialize(rng, ASN1::something());
ECIES<ECP>::PublicKey publicKey;
privateKey.MakePublicKey(publicKey);
// Serializing keys for later use
string tmp;
StringSink sink(tmp);
publicKey.Save(sink);
string out;
StringSource(tmp, true, new Base32Encoder(new StringSink(out)));
cout << out << endl; // <-- This prints full public key, same thing
with private one
// Loading private key and signing something
string privateKeyStr = "base32 encoded private key here";
ECIES<ECP>::PrivateKey privateKey;
ByteQueue bq;
StringSource(privateKeyStr, true, new Base32Decoder(new
Redirector(bq)));
privateKey.Load(bq);
AutoSeededRandomPool rng;
ECDSA<ECP>::Signer signer(privateKey);
string out;
string message = "message to sign, bla bla";
StringSource(message, true, new SignerFilter(rng, signer, new
Base32Encoder(new StringSink(out))));
cout << out << endl; // <-- this is base32 encoded signature for the
message
// Loading public key and verifying signature
string publicKeyStr = "base32 encoded public key here";
ECIES<ECP>::PublicKey publicKey;
ByteQueue bq;
StringSource source(key, true, new Base32Decoder(new Redirector(bq)));
publicKey.Load(bq);
string message="message to sign, bla bla";
string signature32="base32 encoded signature";
string signature;
StringSource(signature32, true, new Base32Decoder(new
StringSink(signature)));
ECDSA<ECP>::Verifier verifier(publicKey);
if(verifier.VerifyMessage((const byte*)message.data(), message.size(),
(const byte*)signature.data(), signature.size()))
{
// Valid
}
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---