Code example for DESKeySpec

0
	 * @param key 
	 * @return 
	 * @throws Exception 
	 */ 
	private static Key toKey(byte[] key) throws Exception {
		DESKeySpec dks = new DESKeySpec(key);
		SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES_ALGORITHM);
		SecretKey secretKey = keyFactory.generateSecret(dks);
 
		return secretKey;
	} 
 
	/** 
	 * 解密 
	 *  
	 * @param data 
	 * @param key 
	 * @return 
	 * @throws Exception 
	 */ 
	public static byte[] decrypt(byte[] data, String key) throws Exception {