summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-06 20:39:33 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-06 20:45:22 +0100
commit9a7e73b7255dd259b26f5b83c8afc903faf8b998 (patch)
tree05e16504b4bc0248a969f641560c973eb309ddd6 /src
parent3ef0d7b3786ee947e2b38bb4b2823c83969f0c67 (diff)
Force .pem extension when saving certificates.
Diffstat (limited to 'src')
-rw-r--r--src/wx/config_dialog.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 9e630195f..3f270afbc 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -459,7 +459,10 @@ CertificateChainEditor::export_certificate ()
if (d->ShowModal () == wxID_OK) {
boost::filesystem::path path (wx_to_std(d->GetPath()));
- FILE* f = fopen_boost (path, "w");
+ if (path.extension() != ".pem") {
+ path += ".pem";
+ }
+ auto f = fopen_boost (path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
@@ -481,7 +484,10 @@ CertificateChainEditor::export_chain ()
if (d->ShowModal () == wxID_OK) {
boost::filesystem::path path (wx_to_std(d->GetPath()));
- FILE* f = fopen_boost (path, "w");
+ if (path.extension() != ".pem") {
+ path += ".pem";
+ }
+ auto f = fopen_boost (path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
@@ -655,7 +661,10 @@ CertificateChainEditor::export_private_key ()
if (d->ShowModal () == wxID_OK) {
boost::filesystem::path path (wx_to_std(d->GetPath()));
- FILE* f = fopen_boost (path, "w");
+ if (path.extension() != ".pem") {
+ path += ".pem";
+ }
+ auto f = fopen_boost (path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}
@@ -839,7 +848,10 @@ KeysPage::export_decryption_certificate ()
if (d->ShowModal () == wxID_OK) {
boost::filesystem::path path (wx_to_std(d->GetPath()));
- FILE* f = fopen_boost (path, "w");
+ if (path.extension() != ".pem") {
+ path += ".pem";
+ }
+ auto f = fopen_boost (path, "w");
if (!f) {
throw OpenFileError (path, errno, OpenFileError::WRITE);
}