Feature: export the built-in TLS certificate from the settings dialog
The built-in certificate lives only inside the server config as base64 DER, so there was no way to take it elsewhere -- to install it as a custom certificate on another machine, or to hand it to a proxy. The TLS certificate dialog now has an Export Certificate button next to the Built-in Certificate checkbox. It is enabled only while that box is checked. Clicking it opens a save dialog and writes two PEM files: the chosen .crt and a .key with the same base name in the same directory. The key is PKCS#8 and unencrypted; the success message says so. If the certificate has not been generated yet (box checked but the dialog not applied), the export generates it first, the same way OK does, then refreshes the expiry text. If the key cannot be written, the certificate written just before it is deleted, so no half pair is left. Translations added for en_US, zh_TW and de_DE; en_US and zh_TW are also embedded resources, so the server was rebuilt. Verified: Debug x64 server builds clean. Drove the dialog on a running Debug instance over window messages -- the button, its label and its enabled state track the checkbox. The PEM writer was checked against OpenSSL (x509 -subject, pkey -check) using the same CryptoAPI flags. The save dialog itself was not automated end to end. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
6a51116873
commit
cc9ce35c4d
7 files changed
+133
-2
No files matched your search
@@ -29,10 +29,12 @@ private:
|
||||
IDC_TLS_KEY_BROWSE = 2005, // 私钥路径「浏览...」按钮
|
||||
IDC_TLS_BUILTIN = 2006, // 「内置证书」复选框(缺省勾选)
|
||||
IDC_TLS_BUILTIN_INFO= 2007, // 内置证书说明(只读静态文本)
|
||||
IDC_TLS_BUILTIN_EXPORT = 2008, // 「导出证书」按钮(勾选内置证书时可用)
|
||||
};
|
||||
|
||||
CButton m_btnEnable;
|
||||
CButton m_btnBuiltin;
|
||||
CButton m_btnExport;
|
||||
CStatic m_lblBuiltinInfo;
|
||||
CStatic m_lblCert, m_lblKey;
|
||||
CEdit m_editCert, m_editKey;
|
||||
@@ -45,5 +47,6 @@ private:
|
||||
void OnBrowseCert();
|
||||
void OnBrowseKey();
|
||||
void OnBuiltinToggle(); // 勾选状态变化:置灰/恢复自定义证书控件
|
||||
void OnExportBuiltin(); // 把内置证书导出为 .crt + .key
|
||||
void UpdateBuiltinUi(); // 同步内置证书说明文本
|
||||
};
|
||||
Reference in new issue
Block a user