增加即时消息内容AES加密

This commit is contained in:
wanggeng 2021-12-08 20:48:52 +08:00
parent 025388cc86
commit 27d586a9bb
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ public class WebSocketTextHandler {
MessageSendStatusBody messageSendStatusBody = null; MessageSendStatusBody messageSendStatusBody = null;
try { try {
if (webSocketProperties.getEncrypt()) { if (webSocketProperties.getEncrypt()) {
String decodeMessage = AesUtil.aesCommonDecoder(WebSocketChannelManager.MESSAGE_AES_KEY, textWebSocketFrame.text()); String decodeMessage = AesUtil.aesCommonDecoder(webSocketProperties.getAesKey(), textWebSocketFrame.text());
clientSocketMessage = JSONObject.parseObject(decodeMessage, WebSocketClientMessage.class); clientSocketMessage = JSONObject.parseObject(decodeMessage, WebSocketClientMessage.class);
} else { } else {
clientSocketMessage = JSONObject.parseObject(textWebSocketFrame.text(), WebSocketClientMessage.class); clientSocketMessage = JSONObject.parseObject(textWebSocketFrame.text(), WebSocketClientMessage.class);

View File

@ -158,7 +158,7 @@ public class WebSocketChannelManager implements IWebSocketChannelManager {
} }
String message; String message;
if (webSocketProperties.getEncrypt()) { if (webSocketProperties.getEncrypt()) {
message = AesUtil.aesCommonEncoder(MESSAGE_AES_KEY, JSONObject.toJSONString(webSocketClientMessage)); message = AesUtil.aesCommonEncoder(webSocketProperties.getAesKey(), JSONObject.toJSONString(webSocketClientMessage));
} else { } else {
message = JSONObject.toJSONString(webSocketClientMessage); message = JSONObject.toJSONString(webSocketClientMessage);
} }