public static byte [ ] generateKey ( String keyType , int keyLength ) throws NoSuchAlgorithmException { KeyGenerator generator = KeyGenerator . getInstance ( keyType ) ; generator . init ( keyLength ) ; return generator . generateKey ( ) . getEncoded ( ) ; }
Generate a new AES key used to encrypt the message .