According to the documentation, it would seem as though API level 18 does support different RSA Key
sizes. But according to another source (referencing API level 18):
There is currently no way to specify key size or type and generated
keys default to 2048 bit RSA.
Though, I suppose you should be able to use a different AlgorithmParameterSpec
, such as the old RSAKeyGenParameterSpec
available since API level 1; which takes a key size as a constructor argument:
keyPairGenerator.initialize(new RSAKeyGenParameterSpec(keySize, publicExponent));