Here you can find the source of getKey(String keyRule)
public static byte[] getKey(String keyRule)
//package com.java2s; //License from project: Open Source License import java.security.Key; import javax.crypto.spec.SecretKeySpec; public class Main { public static byte[] getKey(String keyRule) { Key key = null;/*from ww w.jav a 2 s . c o m*/ byte[] keyByte = keyRule.getBytes(); byte[] byteTemp = new byte[8]; for (int i = 0; i < byteTemp.length && i < keyByte.length; i++) { byteTemp[i] = keyByte[i]; } key = new SecretKeySpec(byteTemp, "DES"); return key.getEncoded(); } }