// 密钥(固定密钥只为测试使用,实际根据项目的密钥)
private final static String secretKey = "c528fb5862b48f03e1ad3d4ee68c670c";
//向量长度必须为8的倍数
private final static String iv = "01234567";
// 编码方式
private final static String encoding = "utf-8";
加密
/**
* 3des加密
* @param deviceSecret 需要加密的内容
* @return
*/
public String Encrypt(String deviceSecret){
String asciiString = "";
Key deskey = null;
try {
DESedeKeySpec spec = new DESedeKeySpec(secretKey.getBytes());
SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("desede");
deskey = keyfactory.generateSecret(spec);
Cipher cipher = Cipher.getInstance("desede/CBC/PKCS5Padding");
IvParameterSpec ips = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, deskey, ips);
byte[] encryptData = Base64Utils.encode(cipher