记一下解决思路:

base64编码出现的问题。

加解密这样写:

/**
     * base64 解密
     *
     * @param value 解密字符串
     * @return
     */
    public static String base64Decode(String value) {
        Base64.Decoder decoder = Base64.getMimeDecoder();
        return new String(decoder.decode(value.getBytes()), StandardCharsets.ISO_8859_1);
    }

    /**
     * base64加密
     *
     * @param value 加密字符串
     * @return
     */
    public static String base64Encode(String value) {
        Base64.Encoder encoder = Base64.getMimeEncoder();
        byte[] bytes = encoder.encode(value.getBytes(StandardCharsets.ISO_8859_1));
        return new String(bytes);
    }


 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐