bdd-predicate icon indicating copy to clipboard operation
bdd-predicate copied to clipboard

DSA

Open inm7ripe opened this issue 4 years ago • 5 comments

Hello Martin!

Is it possible to use your approach with a minor changes for DSA?

WBR, Igor

inm7ripe avatar Sep 05 '21 12:09 inm7ripe

@factorable is the real expert here but AFAIK yes, if you're up for writing a bit of code.

malb avatar Sep 05 '21 16:09 malb

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.

factorable avatar Sep 08 '21 23:09 factorable

Thanks a lot and some stupid questions:

  1. 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?
  2. Can you give me a hint about other function modification ( volf, ghf, evf ...) ? Thanks in advance! WBR, Igor

inm7ripe avatar Sep 15 '21 06:09 inm7ripe

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.

malb avatar Sep 15 '21 09:09 malb

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.

inm7ripe avatar Sep 15 '21 15:09 inm7ripe