Here you can find the source of generateKey(String secretKey)
private static SecretKey generateKey(String secretKey) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Apache License import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; public class Main { private static SecretKey generateKey(String secretKey) throws NoSuchAlgorithmException { SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(secretKey.getBytes()); KeyGenerator kg = null;/* www. j a va 2s . c o m*/ try { kg = KeyGenerator.getInstance("DES"); } catch (NoSuchAlgorithmException nosuchalgorithmexception) { } kg.init(secureRandom); return kg.generateKey(); } }