public void generateAesKeys(int numKeys, int startOffset) throws IOException, KeyStoreException {
    for (int i = 1; i <= numKeys; i++) {
      SecretKey key = generateKey();
      ks.setEntry(String.valueOf(i + startOffset), new KeyStore.SecretKeyEntry(key),
          new KeyStore.PasswordProtection(password));
    }

    saveKeystore();
  }
public void generateAesKeys ( int numKeys , int startOffset ) throws IOException , KeyStoreException { for ( int i = 1 ; i <= numKeys ; i ++ ) { SecretKey key = generateKey ( ) ; ks . setEntry ( String . valueOf ( i + startOffset ) , new KeyStore . SecretKeyEntry ( key ) , new KeyStore . PasswordProtection ( password ) ) ; } saveKeystore ( ) ; }
Generate a set of AES keys for the store. The key ids will simple be (startOffset ... startOffset + numKeys).
@param numKeys Number of keys to generate
@param startOffset ID to start generating keys with
@throws IOException If there is an error serializing the keystore back to disk
@throws KeyStoreException If there is an error serializing the keystore back to disk