Java tutorial
//package com.java2s; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import java.security.*; public class Main { private static int KEY_LENGTH_AES = 192; public static SecretKey generateAesKey() { try { KeyGenerator kg = KeyGenerator.getInstance("AES"); kg.init(KEY_LENGTH_AES); SecretKey key = kg.generateKey(); return key; } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }