带有"\n"的json格式化之后解密不出来
yemamumu opened this issue · comments
yemamumu commented
{ "ret_result": { "ret_code": 10330, "ret_message": "类别Id为空" } }
服务端返回这种格式的json时,可以解密
{
"ret_result": {
"ret_code": 1,
"ret_message": "成功"
}
}
服务端返回这种格式的json时,解密不出来
Bruce commented
你这么问得很笼统,大概看上去意思是字符串带回车之后,服务端的加密,到客户端解密的时候解出来了。
问下,您这边服务端用的加密代码和客户端加密代码是一套代码吗?我指的是代码一致,不是算法一致。
yemamumu commented
本地测试(您的demo):
String encode = AESEncrypt.encode(this, "{\n" +
""ret_result": {\n" +
""ret_code": 1,\n" +
""ret_message": "成功"\n" +
"}\n" +
"}");
加密出来的结果是:ZjOVGtGsAT7yZivQhR/xI9o1lS5DWvsMEO+stk/Kx8/woMAKoEtQcevF8sJJeIUlycn/22lIMN9WMR2KMgiFSg==
结果:解密失败
Bruce commented
好的记下了 ,有空我看下。
Bruce commented
解密是解出来了,但是"\n"后面的东西都丢了。