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
@@ -39,6 +39,10 @@ bool ReadDer(config& cfg, std::vector<BYTE>& certDer, std::vector<BYTE>& keyDer)
|
||||
// 内置证书的 PEM 文本(下发客户端信任锚用)。未生成时返回空串。
|
||||
std::string CertPem(config& cfg);
|
||||
|
||||
// 导出用的两份 PEM:证书(BEGIN CERTIFICATE)与私钥(PKCS#8,BEGIN PRIVATE KEY)。
|
||||
// 任一缺失或无法编码时返回 false。私钥以明文导出,调用方负责提示用户保管。
|
||||
bool ExportPem(config& cfg, std::string& certPem, std::string& keyPem);
|
||||
|
||||
// 对话框展示用:证书到期日 "2036-11-01"。未生成/无法解析时返回空串。
|
||||
std::string Describe(config& cfg);
|
||||
}
|
||||
Reference in new issue
Block a user