On Monday, August 18, 2014 2:34:30 PM UTC-4, [email protected] wrote:
>
> Hello. I have a question. When signing something using DSA or ECDSA, is 
> there a way to override the k-value supplied by Crypto++? I've been looking 
> into the code and haven't been able to find a definitive answer just yet. 
> Any help would be greatly appreciated.
>
In the case of DSA, the signing occurs in gfpcrypt.h:

00152 class DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm<T>
00153 {
00154 public:
00155         static const char * CRYPTOPP_API StaticAlgorithmName() 
{return "DSA-1363";}
00156 
00157         void Sign(const DL_GroupParameters<T> &params, const Integer 
&x, const Integer &k, const Integer &e, Integer &r, Integer &s) const
00158         {
00159                 const Integer &q = params.GetSubgroupOrder();
00160                 r %= q;
00161                 Integer kInv = k.InverseMod(q);
00162                 s = (kInv * (x*r + e)) % q;
00163                 assert(!!r && !!s);
00164         }
...

You might try working up from there. I suspect you'll encounter DL_Keys_DSA 
on the way up. In particular:

00384 struct CRYPTOPP_DLL DSA : public DL_SS<
00385         DL_Keys_DSA, 
00386         DL_Algorithm_GDSA<Integer>, 
00387         DL_SignatureMessageEncodingMethod_DSA,
00388         SHA, 
00389         DSA>
00390 {
...

That's probably where I would look to start adding a public method to set k 
from the outside world.

Related:

  * http://www.cryptopp.com/docs/ref/struct_d_l___keys___d_s_a.html
  * http://www.cryptopp.com/docs/ref/gfpcrypt_8h_source.html

Jeff

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to