Here you can find the source of createSessionKey()
Parameter | Description |
---|---|
Exception | an exception |
public static String createSessionKey() throws Exception
//package com.java2s; //License from project: Open Source License import javax.crypto.KeyGenerator; import javax.xml.bind.DatatypeConverter; public class Main { /**/*from w w w .j a va 2 s .com*/ * Creates random session keys * @return * @throws Exception */ public static String createSessionKey() throws Exception { KeyGenerator gen = KeyGenerator.getInstance("AES"); gen.init(128); byte[] original = gen.generateKey().getEncoded(); String s = DatatypeConverter.printBase64Binary(original); return s; } }