DES
加密与解密工具类
public class DesUtil<BASE64Encoder> {
private SecretKey key = null;
private static String algorithm = "AES";
private static DesUtil desUtil = null;
public DesUtil() {
}
public static DesUtil getInstance(String strKey) {
desUtil = new DesUtil();
desUtil.createKey(strKey);
return desUtil;
}
public void createKey(String strKey) {
try {
KeyGenerator kg = KeyGenerator.getInstance(DesUtil.algorithm);
byte[] bt = strKey.getBytes("UTF-8");
SecureRandom sr = new SecureRandom(bt);
kg.init(sr);
this.setKey(kg.