Here you can find the source of generateKey(byte[] keyBytes)
private static Key generateKey(byte[] keyBytes) throws Exception
//package com.java2s; //License from project: Apache License import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import java.security.Key; import java.security.spec.KeySpec; public class Main { private static final String DES = "DES"; private static Key generateKey(byte[] keyBytes) throws Exception { KeySpec keySpec = new DESKeySpec(keyBytes); SecretKeyFactory factory = SecretKeyFactory.getInstance(DES); return factory.generateSecret(keySpec); }/*from www . j a v a 2s . c o m*/ }