You can just do this:

verifier->k = new ECDSA<ECP, Tiger>::Verifier(*(self->k));
verifier->k->AccessKey().AccessGroupParameters().SetPointCompression(true);

--------------------------------------------------
From: "Zooko Wilcox-O'Hearn" <[email protected]>
Sent: Tuesday, May 26, 2009 3:12 PM
To: "Crypto++ Users" <[email protected]>
Subject: how to construct a public ECDSA key with point compression turned 
on?

>
> Folks:
>
> In pycryptopp I have the following horrible code:
>
> http://allmydata.org/trac/pycryptopp/browser/pycryptopp/publickey/
> ecdsamodule.cpp?rev=607#L441
>
> ------- begin included excerpt of horrible code
>     const DL_PrivateKey_EC<ECP>* privkey;
>     privkey = dynamic_cast<const DL_PrivateKey_EC<ECP>*>(&(self->k-
> >GetPrivateKey()));
>     if (!privkey)
>         return PyErr_Format(ecdsa_error, "dynamic_cast failed for k-
> >GetPrivateKey()");
>
>     const DL_GroupParameters_EC<ECP>& params = privkey-
> >GetGroupParameters();
>
>     // Ugh..  Making a temp Verifier just to get the public element
> to construct the real verifier along with params.
>     ECDSA<ECP, Tiger>::Verifier* temp = new ECDSA<ECP,
> Tiger>::Verifier(*(self->k));
>     const DL_PublicKey_EC<ECP>* temppubkey;
>     temppubkey = dynamic_cast<const DL_PublicKey_EC<ECP>*>(&(temp-
> >GetPublicKey()));
>     if (!temppubkey)
>         return PyErr_Format(ecdsa_error, "dynamic_cast failed for
> temp->GetPublicKey()");
>     ECP::Element pubel = temppubkey->GetPublicElement();
>
>     verifier->k = new ECDSA<ECP, Tiger>::Verifier(params, pubel);
> ------- end included excerpt of horrible code
>
> The purpose of this horrible code is simply to get the ECDSA public
> key which corresponds to the given ECDSA private key while having
> point-compression turned on.  What's the non-horrible way to do this?
>
> Regards,
>
> Zooko
> ---
> Tahoe, the Least-Authority Filesystem -- http://allmydata.org
> store your data: $10/month -- http://allmydata.com/?tracking=zsig
> I am available for work -- http://zooko.com/résumé.html
> >
> 

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