RSA is inherently slow, and gets slower when you use bigger key lengths. There are however things you can do to speed up RSA operations:
- Use a public key with a public exponent that has few bits set to
1
, e.g. the fourth number of Fermat, 65537. Note that there are some attacks that can be performed on a public exponent with value 3. This only speeds up public key operations. - use a
RSAPrivateCrtKey
that includes parameters that can be used for calculations using the Chinese Remainder Theorem. This only speeds up private key operations.
If you have already generated a key pair on the card, chances are that both options have already been lifted by the chip. In that case the solution space may be empty. The only thing you can do then is to switch to Elliptic Curve cryptography (but even that may be slower for public key operations) or a different protocol using symmetric algorithms.