DSA
Hello Martin!
Is it possible to use your approach with a minor changes for DSA?
WBR, Igor
@factorable is the real expert here but AFAIK yes, if you're up for writing a bit of code.
It depends what you mean by "minor changes". The exact same algorithmic approach works for DSA, but unfortunately the code in ecdsa_hnp.py is basically littered with curve operations that will need to be changed, basically everything having to do with parsing input and checking the predicate. You'll only need to modify ecdsa_cli.py and ecdsa_hnp.py, though. The pycrypto library should help with DSA public key parsing.
Thanks a lot and some stupid questions:
- I've done some modification in code in functions _data_for_test and predicate in addition to input parser _data_for_test: G_powers[Integer(M.B[row][0] / f)] = power_mod(self.ecdsa.g,Integer(M.B[row][0] / f),self.ecdsa.p) % self.ecdsa.q G_powers[w] = power_mod(self.ecdsa.g,w,self.ecdsa.p) % self.ecdsa.q predicate: if kG * G_powers[w] % self.ecdsa.p % self.ecdsa.q == r: return True elif -kG * G_powers[w] % self.ecdsa.p % self.ecdsa.q == r: return True Is it correct?
- Can you give me a hint about other function modification ( volf, ghf, evf ...) ? Thanks in advance! WBR, Igor
Hi Igor, FWIW I'd say a better way to go about this is to create a fresh dsa_hnp.py file which constructs the lattice for DSA, without any EC references in there. I think the volume, expected length etc should be analogous to how it's done for ECDSA. Doing this as an independent class/file means it will be much easier to see what needs to happen and where. Most of the lattice magic is hidden in usvp.py anyway, so this can be easily reused.
I totally agree with you. DSA code should be located in a separate class for a full-fledged project, but currently I'm afraid I'm confused with shifting from elliptic curve point operations to power mod operations, so I'm using "if self.is_dsa:" hack to place DSA related code and debug it. Unfortunately in my case predicate function always return "false" , so I asked my previous question number one.