Improve: Generate HMAC while generating pass code
This commit is contained in:
Binary file not shown.
@@ -3139,8 +3139,10 @@ void CMy2015RemoteDlg::OnToolInputPassword()
|
||||
CInputDialog dlg(this);
|
||||
dlg.m_str = pwd;
|
||||
dlg.Init("更改口令", "请输入新的口令:");
|
||||
dlg.Init2("HMAC (非必须):", THIS_CFG.GetStr("settings", "HMAC", "").c_str());
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
THIS_CFG.SetStr("settings", "Password", dlg.m_str.GetString());
|
||||
THIS_CFG.SetStr("settings", "HMAC", dlg.m_sSecondInput.GetString());
|
||||
#ifdef _DEBUG
|
||||
SetTimer(TIMER_CHECK, 10 * 1000, NULL);
|
||||
#else
|
||||
@@ -3613,7 +3615,7 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (g_2015RemoteDlg->m_pActiveSession)
|
||||
else if (g_2015RemoteDlg->m_pActiveSession && operateWnd)
|
||||
{
|
||||
auto screen = (CScreenSpyDlg*)(g_2015RemoteDlg->m_pActiveSession);
|
||||
if (!screen->m_bIsCtrl) {
|
||||
|
||||
@@ -164,6 +164,7 @@ void CPwdGenDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_EDIT_HOSTNUM, m_EditHostNum);
|
||||
DDX_Text(pDX, IDC_EDIT_HOSTNUM, m_nHostNum);
|
||||
DDV_MinMaxInt(pDX, m_nHostNum, 2, 10000);
|
||||
DDX_Control(pDX, IDC_EDIT_HMAC, m_EditHMAC);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,9 +198,12 @@ void CPwdGenDlg::OnBnClickedButtonGenkey()
|
||||
std::string hardwareID = getHardwareID();
|
||||
std::string hashedID = hashSHA256(hardwareID);
|
||||
std::string deviceID = getFixedLengthID(hashedID);
|
||||
std::string hmac = genHMAC(pwdHash, m_sUserPwd.GetString());
|
||||
m_EditHMAC.SetWindowTextA(hmac.c_str());
|
||||
if (deviceID == m_sDeviceID.GetString()) { // 授权的是当前主控程序
|
||||
auto settings = "settings", pwdKey = "Password";
|
||||
THIS_CFG.SetStr(settings, pwdKey, fixedKey.c_str());
|
||||
THIS_CFG.SetStr(settings, "HMAC", hmac);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,4 +76,5 @@ public:
|
||||
virtual BOOL OnInitDialog();
|
||||
CEdit m_EditHostNum;
|
||||
int m_nHostNum;
|
||||
CEdit m_EditHMAC;
|
||||
};
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user