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:
yuanyuanxianganddeepseek-flash committed 2026-11-06 12:13:07 +01:00
1 parent 6a51116873
commit cc9ce35c4d
7 files changed
+133 -2

No files matched your search

+5
View File
@@ -2146,6 +2146,11 @@ TLS֤
内置证书=Integriertes Zertifikat
自签证书,有效期至=Selbstsigniertes Zertifikat, gueltig bis
首次启用时自动生成=Wird bei der ersten Verwendung automatisch erzeugt
导出证书=Zertifikat exportieren
内置证书尚未生成或已损坏,无法导出。=Das integrierte Zertifikat wurde noch nicht erzeugt oder ist beschaedigt und kann nicht exportiert werden.
导出失败:无法写入文件,请检查目录是否可写。=Export fehlgeschlagen: Die Datei konnte nicht geschrieben werden; bitte pruefen, ob das Verzeichnis schreibbar ist.
证书与私钥已导出:=Zertifikat und privater Schluessel exportiert:
私钥为明文,请妥善保管。=Der private Schluessel liegt im Klartext vor; bitte sicher aufbewahren.
内置证书生成/加载失败,加密功能未生效。请查看日志,或取消勾选「内置证书」后改用本地证书与私钥。=Integriertes Zertifikat konnte nicht erzeugt oder geladen werden; Verschluesselung ist inaktiv. Bitte Log pruefen oder "Integriertes Zertifikat" abwaehlen und ein lokales Zertifikat mit privatem Schluessel verwenden.
请填写证书路径=Bitte Zertifikatspfad angeben
请填写私钥路径=Bitte Pfad zum privaten Schluessel angeben