Here you can find the source of getRawKey(String key)
private static byte[] getRawKey(String key) throws Exception
//package com.java2s; import java.security.SecureRandom; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class Main { private static byte[] getRawKey(String key) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(key.getBytes());/*from w ww . jav a 2 s. com*/ kgen.init(256, sr); SecretKey skey = kgen.generateKey(); return skey.getEncoded(); } }