diff options
Diffstat (limited to 'Swift/Controllers/Storages/CertificateFileStorage.cpp')
| -rw-r--r-- | Swift/Controllers/Storages/CertificateFileStorage.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Swift/Controllers/Storages/CertificateFileStorage.cpp b/Swift/Controllers/Storages/CertificateFileStorage.cpp index 8ba7d12..2e1343f 100644 --- a/Swift/Controllers/Storages/CertificateFileStorage.cpp +++ b/Swift/Controllers/Storages/CertificateFileStorage.cpp | |||
| @@ -50,10 +50,15 @@ void CertificateFileStorage::addCertificate(Certificate::ref certificate) { | |||
| 50 | std::cerr << "ERROR: " << e.what() << std::endl; | 50 | std::cerr << "ERROR: " << e.what() << std::endl; |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | boost::filesystem::ofstream file(certificatePath, boost::filesystem::ofstream::binary|boost::filesystem::ofstream::out); | 53 | try { |
| 54 | ByteArray data = certificate->toDER(); | 54 | boost::filesystem::ofstream file(certificatePath, boost::filesystem::ofstream::binary|boost::filesystem::ofstream::out); |
| 55 | file.write(reinterpret_cast<const char*>(vecptr(data)), boost::numeric_cast<std::streamsize>(data.size())); | 55 | ByteArray data = certificate->toDER(); |
| 56 | file.close(); | 56 | file.write(reinterpret_cast<const char*>(vecptr(data)), boost::numeric_cast<std::streamsize>(data.size())); |
| 57 | file.close(); | ||
| 58 | } | ||
| 59 | catch (...) { | ||
| 60 | SWIFT_LOG(warning) << "Failed to store certificate to " << certificatePath << std::endl; | ||
| 61 | } | ||
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | boost::filesystem::path CertificateFileStorage::getCertificatePath(Certificate::ref certificate) const { | 64 | boost::filesystem::path CertificateFileStorage::getCertificatePath(Certificate::ref certificate) const { |
Swift