BASE64 以 UTF-8 加密解密
import org.apache.commons.codec.binary.Base64;
import java.io.UnsupportedEncodingException;
public class BASE64 {
public static String decryptBASE64(String encodeStr) {
byte[] b = encodeStr.getBytes();
Base64 base64 = new Base64();
b = base64.decode(b);
String s = new String(b);
return s;
}
public static String encryptBASE64(String plainText) {
byte[] b = new byte[0];
try {
b = plainText.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Base64 base64 = new Base64();
b = base64.encode(b);
String s = new String(b);
return s;
}
}