Files
SimpleRemoter/server/2015Remote/TlsCertificateDlg.h
T
yuanyuanxianganddeepseek-v4-pro c93f09e9ac Feat: TLS certificate menu and config dialog for the MFC server
Add a "TLS证书" item to the Extensions menu below "MCP设置" that opens a
runtime-built dialog to enable one-way TLS and set the certificate and
private-key paths. On OK it writes the [tls] Enabled/CertPath/KeyPath keys
and calls ServerTlsIdentity::Load() so the change takes effect for new
connections immediately (design doc §7.1), mirroring the existing
CMcpSettingsDlg runtime-template pattern. All new strings are wired into
the en_US / zh_TW / de_DE language files, and the menu item is gated by
HIDE_MENU_TLS_CERTIFICATE / MF_TLS_CERTIFICATE like MCP settings.

Co-Authored-By: deepseek-v4-pro
2026-10-15 19:42:52 +02:00

44 lines
1.3 KiB
C++

#pragma once
#include <afxwin.h>
#include <afxcmn.h>
#include <vector>
// 「TLS证书」配置对话框:启用服务端单向 TLS 加密 + 指定证书/私钥路径。
// 因 2015Remote.rc 为 UTF-16 编码、不宜手工编辑,参照 CMcpSettingsDlg 用
// InitModalIndirect + 内存 DLGTEMPLATE 程序化创建(见 docs/TransportTLS_MFCServer_Design.md §7.1)。
class CTlsCertificateDlg : public CDialog
{
public:
explicit CTlsCertificateDlg(CWnd* parent = nullptr);
virtual INT_PTR DoModal();
protected:
virtual BOOL OnInitDialog();
virtual void OnOK();
DECLARE_MESSAGE_MAP()
private:
enum CtrlId {
IDC_TLS_ENABLE = 2001, // 「启用加密」复选框
IDC_TLS_CERT = 2002, // 证书路径编辑框
IDC_TLS_CERT_BROWSE = 2003, // 证书路径「浏览...」按钮
IDC_TLS_KEY = 2004, // 私钥路径编辑框
IDC_TLS_KEY_BROWSE = 2005, // 私钥路径「浏览...」按钮
};
CButton m_btnEnable;
CStatic m_lblCert, m_lblKey;
CEdit m_editCert, m_editKey;
CButton m_btnCertBrowse, m_btnKeyBrowse;
CButton m_btnOK, m_btnCancel;
std::vector<BYTE> m_Template; // 内存 DLGTEMPLATE 字节
void LayoutControls(int cx, int cy);
void OnBrowseCert();
void OnBrowseKey();
};