日期:2014-05-17 浏览次数:20838 次
// 解密 Base64(3DES(消息体))
public static String decrypt(String args, String key) {
try {
Des3Util d3u = new Des3Util();
Security.addProvider(new com.sun.crypto.provider.SunJCE());
return d3u.decryptFromBase64(key, args, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public String decryptFromBase64(String key, String src, String encoding) {
try {
BASE64Decoder decoder = new BASE64Decoder();
return new String(
decrypt(key.getBytes(), decoder.decodeBuffer(src)),
encoding);
} catch (Exception ex) {
return null;
// ex.printStackTrace();
}
}