Hello,

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!

My initial idea was to only use the decode point G(x, y) as a public
element. This does not seem to be working
as if I remove the following lines :

 // create a public key from the private key
 PublicKey.AssignFrom(PrivateKey);

The verification crashes. Looking at AssignFrom() shows that indeed it
seems public key is created using the
private exponent.

Should I then export the whole PublicKey? This probably means the
public material is going to be bigger.

Maybe all this makes sense for you guys. It does not on my side.

I thought that using  PublicKey.SetPublicElement(newPoint); would be
enough but it seems not to go that way.

Thank you very much!

Arnaud

Code snippet ( not the the signing and verifying is omitted as it does
not seem to be the problem here ) :
------------------------------------------------------------------------------------------------------------------------------------------------------

CryptoPP::ECDSA< CryptoPP::ECP >::PrivateKey    PrivateKey;

 // initialize the private key from a now certicom curve
 
PrivateKey.AccessGroupParameters().Initialize( CryptoPP::ASN1::secp521r1() );

 // set the the private exponent
 
PrivateKey.SetPrivateExponent(CryptoPP::Integer("147088163948218050")); //
This is the actual private key

 // set up the signer mechanism
 CryptoPP::ECDSA< CryptoPP::ECP >::Signer signer(PrivateKey);

 // get the encoded curve point size then allocate and zero some
memory for it
 int encodedpointsize =
PrivateKey.GetGroupParameters().GetCurve().EncodedPointSize(true);
 byte *pointb = new byte[encodedpointsize];
 memset(pointb, 0, encodedpointsize);

  // allocate a create a public key strcuture
 CryptoPP::ECDSA< CryptoPP::ECP >::PublicKey    PublicKey;

 // create a public key from the private key
 PublicKey.AssignFrom(PrivateKey);

 // actual place the encoded ec point into our buffer
 PrivateKey.GetGroupParameters().GetCurve().EncodePoint(pointb,
PublicKey.GetPublicElement(), true);

 // initialize the public key
 
PublicKey.AccessGroupParameters().Initialize(CryptoPP::ASN1::secp521r1());

 // create a temporary point
 CryptoPP::ECP::Point newPoint;
 PublicKey.GetGroupParameters().GetCurve().DecodePoint(newPoint,
pointb, encodedpointsize);
 PublicKey.SetPublicElement(newPoint);

 // free memory
 delete pointb;
--~--~---------~--~----~------------~-------~--~----~
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