code: public final void init(int keysize, SecureRandom random) {
          if (serviceIterator == null) {
              spi.engineInit(keysize, random);
              return;
          }
          RuntimeException failure = null;
          KeyGeneratorSpi mySpi = spi;
          do {
              try {
                  mySpi.engineInit(keysize, random);
                  initType = I_SIZE;
                  initKeySize = keysize;
                  initParams = null;
                  initRandom = random;
                  return;
              } catch (RuntimeException e) {
                  if (failure == null) {
                      failure = e;
                  }
                  mySpi = nextSpi(mySpi, false);
              }
          } while (mySpi != null);
          throw failure;
      }
docs: Initializes this key generator for a certain keysize, using a
  user-provided source of randomness.
  
  @param keysize the keysize. This is an algorithm-specific metric,
  specified in number of bits.
  @param random the source of randomness for this key generator
  
  @exception InvalidParameterException if the keysize is wrong or not
  supported.