From: Carl Hetherington Date: Sat, 6 Feb 2021 19:39:33 +0000 (+0100) Subject: Force .pem extension when saving certificates. X-Git-Tag: v2.15.127~19 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=9a7e73b7255dd259b26f5b83c8afc903faf8b998 Force .pem extension when saving certificates. --- 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); }