Here you can find the source of toKey(byte[] key)
Parameter | Description |
---|---|
key | binary secret key |
private static Key toKey(byte[] key)
//package com.java2s; import java.security.Key; import javax.crypto.spec.SecretKeySpec; public class Main { /**//w w w . j a v a 2 s . co m * Secret Key algorithms */ private static final String KEY_ALGORITHM = "AES"; /** * transfer secret key * * @param key binary secret key * @return secret key */ private static Key toKey(byte[] key) { //create secret key return new SecretKeySpec(key, KEY_ALGORITHM); } }