# Can we defends against RSA Timing attack when we use java.math.BigInteger.modPow?

I think that Montgomery and sliding window techniques are applied within java.math.BigInteger.modPow (and more specifically oddModPow). The sliding window technique is known to be vulnerable to RSA timing attacks as an adversary can distinguish between 0 and 1.

So if I implement RSA using java.math.BigInteger.modPow, is it vulnerable to RSA timing attack?

If it is not vulnerable to RSA timing attack, why?

• Welcome to crypto.SE. Please edit the question for clarity. We can't get what's asked. It could be A) "Does the java.math.BigInteger.modPow method include measures to defend against RSA Timing attack?". B) "Can we make an alternative to java.math.BigInteger.modPow that defends against RSA Timing attack?". C) "Can we defends against RSA Timing attack when we use java.math.BigInteger.modPow?". Is the question focused on an implementation of RSA without CRT? Why the DSA tag? Are timing attacks on the padding at decryption (which do not recover the private key) part of the question? – fgrieu Jun 29 at 6:03