Here you can find the source of generateKey(byte[] randomSeed)
public static byte[] generateKey(byte[] randomSeed) throws Exception
//package com.java2s; import java.security.SecureRandom; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class Main { private static final String CIPHER_ALGORITHM = "AES"; private static final String RANDOM_GENERATOR_TYPE = "SHA1PRNG"; private static final int RANDOM_KEY_SIZE = 128; public static byte[] generateKey(byte[] randomSeed) throws Exception { // Set up generators KeyGenerator gen = KeyGenerator.getInstance(CIPHER_ALGORITHM); SecureRandom rand = SecureRandom.getInstance(RANDOM_GENERATOR_TYPE); rand.setSeed(randomSeed);//from w ww . j a v a 2s .co m // Generate key gen.init(RANDOM_KEY_SIZE, rand); SecretKey myKey = gen.generateKey(); return myKey.getEncoded(); } }