Java tutorial
//package com.java2s; import java.security.Key; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class Main { private static final String ALGORITHM = "AES"; private static Key toKey(byte[] key) throws Exception { SecretKey secretKey = new SecretKeySpec(key, ALGORITHM); return secretKey; } }