import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class NewEncryptUtil {
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static String decryptBASE64(String key) throws Exception {
return new String((new BASE64Decoder()).decodeBuffer(key));
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(String key) throws Exception {
return new String((new BASE64Encoder()).encodeBuffer(key.getBytes()));
}
}
`
JAVA中的BASE64加解密
最新推荐文章于 2023-12-25 08:15:00 发布