import javax.crypto.*; static SecretKey crypto_makeAESKey(S password, byte[] salt) ctex { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); // only with unlimited strength: //KeySpec spec = new PBEKeySpec(password, salt, 65536, 256); // Let's try this: KeySpec spec = new PBEKeySpec(toCharArray(password), salt, 65536, 128); ret new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES"); }