简体   繁体   中英

DSA Signature Verification and BigInteger class

I have been given a (very) simple DSA problem, and have already found the key and other variables. To verify the signature I need to somehow translate the equation:

V = [( y^u1*h^u2 )mod p] mod q

into a BigInteger operation. Is this even possible on java? I have been using modPow successfully so far however all problems so far have been in the form:

r.modPow(exponent, modulus);

I have no idea how to do the above equation (in particular the bold part) via BigInteger and I'm wondering if it's even possible. Does anyone have any ideas?

How would I go about putting this equation through Pari if BigInteger can't do it?

I think you just need to use the identity that

(a*b) mod p == ((a mod p)*(b mod p)) mod p

So to calculate y u1 × h u2 mod p:

  1. calculate y u1 mod p, using modPow ,
  2. calculate h u2 mod p, using modPow ,
  3. multiply together the results of steps 1 and 2,
  4. reduce the result of step 3 mod p.

Step 4 is necessary because the results of steps 1 and 2 may multiply together to produce a value greater than p.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM