code: private static Object createKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException {
          Class keyGenClass = lookupKeyGenClass();
          Object keypair = ClassUtil.newInstance(keyGenClass, "RSA", "SHA1WithRSA");
          ClassUtil.applyMethod(keypair, "generate", 2048);
          return keypair;
      }
docs: Reflection based access to KeyGen classes: