AESEncryptUtil在SSM框架下,Tomcat控制台解密错误
YangSimon opened this issue · 0 comments
加密前:[{"roleId":0,"roleName":"财务部领导0","roleType":"0"},{"roleId":0,"roleName":"财务部领导1","roleType":"1"},{"roleId":0,"roleName":"财务部领导2","roleType":"2"},{"roleId":0,"roleName":"财务部领导3","roleType":"3"},{"roleId":0,"roleName":"财务部领导4","roleType":"4"},{"roleId":0,"roleName":"财务部领导5","roleType":"5"},{"roleId":0,"roleName":"财务部领导6","roleType":"6"},{"roleId":0,"roleName":"财务部领导7","roleType":"7"},{"roleId":0,"roleName":"财务部领导8","roleType":"8"},{"roleId":0,"roleName":"财务部领导9","roleType":"9"}]
[INFO ] [14:26:57] com.qtong.rms.act.encryptbody.AESEncryptUtil - 加密后:A9EB8D26BF03E36D31DDC8721F267C674BB14500B0269D8752BD87FB1C4F0BB418EFD59DF3CB11CA8280F70EDDC188F95CC98052108878008E013E4E218BC4B89122C96A0E684BBA707781ADA4F351ED667DFF24EA5F002BD942A3D4BEB8739CF1D341813C4C451205193FD8E926C84C44F1D1C4C5DDF2A297C027D84B8F25CA7F08F4B86EE9A6205F607BA85DEE93D06676EFC1A3E1B2B40D40FBF2845B2CF97B93FD40C5E0EEFC74827D79D172D73614318A726F881BE792E99ABB9C1CD0B5B9BB5DE8E4BD223D438E413BBC679D0BA57D05ED58861C8181797814B045E0C1F673FC0C6B0DDE80337D6847934A011371D1956F71043D10A625272C1E73B30A5CCFFB297160E57A8E7D19D7511027E1C5ECD0416B40AF828CDD0C05C54D8D7C9A9DC76A212497A007D9D6BE15A9E611023F67AA8160D90A9D7B572D917EC6A17827A6D24CD32DB9FB18C9B216BAB1616E0A2731C23427426C16983CE34A1690085324533277D0631819FC5975ACC439A032FCA7543E73AC7C345D85C4A46D0721E40DB4FA774346A3837D900BC21E8DB9E1D796728FF96064251C5E66E9722258F5BB2171AA55C3B19DE3B2481DAEFAF4E1DD95F08314654315ECCE0608374149CAF6D51427BBB5294577B675D690D4D7A74AEA61C845546A7ADD18C610F63D4BB14500B0269D8752BD87FB1C4F0BB4CA9AC9C11ADE4E6F300E45D5917EC66B1CCF453885C054892C1D68CEFD2AE9429122C96A0E684BBA707781ADA4F351ED667DFF24EA5F002BD942A3D4BEB8739C54D595B7A3931A85D58E4AE02366734B568778CA85AD8A43A4C5F9C85E02B0F8
[INFO ] [14:26:57] com.qtong.rms.act.encryptbody.AESEncryptUtil - 解密后:[{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?0","roleType":"0"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?1","roleType":"1"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?2","roleType":"2"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?3","roleType":"3"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?4","roleType":"4"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?5","roleType":"5"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?6","roleType":"6"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?7","roleType":"7"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?8","roleType":"8"},{"roleId":0,"roleName":"璐㈠姟閮ㄩ瀵?9","roleType":"9"}]
中文乱码, 是AESEncryptUtil类中aes方法 解密类型, byte转String的时候,没有增加 utf-8 导致中文乱码
72行改成:return new String(cipher.doFinal(byteContent), "utf-8"); 这样就可以了,