提交 de19316e 编写于 作者: xengine-qyt's avatar xengine-qyt

modify:websocket supports encrypted data transmission

上级 76b3c4fb
......@@ -26,8 +26,22 @@ XHTHREAD CALLBACK XEngine_AuthService_WSThread(LPVOID lParam)
{
continue;
}
//如果使用加密,客户端只能使用XCrypto 加密
if (BST_CHECKED == pClass_This->m_DlgConfig.m_RadioKeyPass.GetCheck())
{
CString m_StrPass;
TCHAR tszDeBuffer[2048];
memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
pClass_This->m_DlgConfig.m_EditPass.GetWindowText(m_StrPass);
OPenSsl_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, m_StrPass.GetBuffer());
XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, enOPCode, pSt_ThreadInfo->lPClass);
}
else
{
XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, enOPCode, pSt_ThreadInfo->lPClass);
}
}
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ListClient, nListCount);
}
return 0;
......
......@@ -25,8 +25,23 @@ XHTHREAD CALLBACK XEngine_AuthService_WSThread(LPVOID lParam)
{
continue;
}
if (st_AuthConfig.st_Crypto.bEnable)
{
TCHAR tszPassword[64];
TCHAR tszDeBuffer[2048];
memset(tszPassword, '\0', sizeof(tszPassword));
memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
_stprintf(tszPassword, _T("%d"), st_AuthConfig.st_Crypto.nPassword);
OPenSsl_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, tszPassword);
XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, enOPCode);
}
else
{
XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, enOPCode);
}
}
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_ListClient, nListCount);
}
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册