Here you can find the source of getKey(String keyString)
public static Key getKey(String keyString)
//package com.java2s; //License from project: Open Source License import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.util.*; import java.io.*; public class Main { public static Key getKey(String keyString) { try {//from w w w.j a va 2 s. c o m byte[] bytes = getBytes(keyString); DESKeySpec pass = new DESKeySpec(bytes); SecretKeyFactory skf = SecretKeyFactory.getInstance("DES"); SecretKey s = skf.generateSecret(pass); return s; } catch (Exception e) { e.printStackTrace(); } return null; } private static byte[] getBytes(String str) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); StringTokenizer st = new StringTokenizer(str, "-", false); while (st.hasMoreTokens()) { int i = Integer.parseInt(st.nextToken()); bos.write((byte) i); } return bos.toByteArray(); } }