加密算法:BASE64 (3DES (SHA1(原始字符串)))算法
public static String base64Encode(byte[] str)
{
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encodeBuffer(str);
}
public static byte[] base64Decode(String str)
{
BASE64Decoder dec = new BASE64Decoder();
try
{
return dec.decodeBuffer(str); // 若是這裏返回的是dec.decodeBuffer(str).toString() 那麼在3DES解密時會報標題的錯誤
}
catch (IOException io)
{
throw new RuntimeException(io.getMessage(), io.getCause());
}
} 加密