mirror of
https://github.com/WuKongIM/WuKongIMAndroidSDK
synced 2025-05-31 21:47:38 +00:00
fix:修改收到信息先验证合法性再解码内容
This commit is contained in:
commit
25caa7a067
@ -168,11 +168,13 @@ public class WKConnection {
|
||||
connectionClient = new ConnectionClient(iNonBlockingConnection -> {
|
||||
connCount = 0;
|
||||
if (iNonBlockingConnection == null || connection == null || !connection.getId().equals(iNonBlockingConnection.getId())) {
|
||||
WKLoggerUtils.getInstance().e(TAG,"重复连接");
|
||||
forcedReconnection();
|
||||
return;
|
||||
}
|
||||
Object att = iNonBlockingConnection.getAttachment();
|
||||
if (att == null || !att.equals(socketSingleID)) {
|
||||
WKLoggerUtils.getInstance().e(TAG,"不属于当前连接");
|
||||
forcedReconnection();
|
||||
return;
|
||||
}
|
||||
|
@ -220,6 +220,11 @@ class WKProto {
|
||||
receivedMsg.topicID = wkRead.readString();
|
||||
}
|
||||
String content = wkRead.readPayload();
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
WKLoggerUtils.getInstance().e(TAG, "消息payload:" + content);
|
||||
receivedMsg.payload = CryptoUtils.getInstance().aesDecrypt(CryptoUtils.getInstance().base64Decode(content));
|
||||
>>>>>>> 9978523a9a818731b66c2409ff4c0cba70fab46f
|
||||
String msgKey = receivedMsg.messageID
|
||||
+ receivedMsg.messageSeq
|
||||
+ receivedMsg.clientMsgNo
|
||||
|
@ -102,11 +102,15 @@ public class CryptoUtils {
|
||||
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException |
|
||||
InvalidAlgorithmParameterException | IllegalBlockSizeException |
|
||||
BadPaddingException e) {
|
||||
<<<<<<< HEAD
|
||||
WKLoggerUtils.getInstance().e(TAG,"aesEncrypt encrypt error");
|
||||
return null;
|
||||
=======
|
||||
WKLoggerUtils.getInstance().e(TAG, "aesEncrypt encrypt error");
|
||||
>>>>>>> 9978523a9a818731b66c2409ff4c0cba70fab46f
|
||||
}
|
||||
if (encrypted == null) {
|
||||
WKLoggerUtils.getInstance().e(TAG,"aesEncrypt The encrypted data is empty");
|
||||
WKLoggerUtils.getInstance().e(TAG, "aesEncrypt The encrypted data is empty");
|
||||
encrypted = sSrc.getBytes();
|
||||
}
|
||||
return encrypted;
|
||||
@ -137,8 +141,9 @@ public class CryptoUtils {
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
public byte[] base64Decode(String data) {
|
||||
return Base64.decode(data, Base64.NO_WRAP);
|
||||
return Base64.decode(data, Base64.NO_WRAP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user