如何在JavaScript 里面实现和Java相同的base64加解密算法?

如题,
我公司服务器上的数据是用java 里面的base64加密后上传至服务器的,现在我在网页端获取到的就是一串字符串,问题是 :如何在网页端对这个字符串进行解密?

加密:encode
解密:decode
就这样拉。

// 解密

public static String getFromBase64(String s) {

byte[] b = null;

String result = null;

if (s != null) {

BASE64Decoder decoder = new BASE64Decoder();

try {

b = decoder.decodeBuffer(s);

result = new String(b, "utf-8");

} catch (Exception e) {

e.printStackTrace();

}

}

return result;

}