From 2a04f3e0abfa9f6174d5ea861ccf1322c7199ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Sat, 10 Apr 2021 18:37:19 -0400 Subject: [PATCH] use dht::toHex for crls Change-Id: I0c4514f9676dc0c29d309c9176e116643e48d198 --- src/jamidht/conversationrepository.cpp | 7 +------ src/security/certstore.cpp | 8 +------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp index 2ddf3044bc..53e8974068 100644 --- a/src/jamidht/conversationrepository.cpp +++ b/src/jamidht/conversationrepository.cpp @@ -182,12 +182,7 @@ add_initial_files(GitRepository& repo, const std::shared_ptr<JamiAccount>& accou for (const auto& crl : account->identity().second->getRevocationLists()) { if (!crl) continue; - auto v = crl->getNumber(); - std::stringstream ss; - ss << std::hex; - for (const auto& b : v) - ss << (unsigned) b; - std::string crlPath = crlsPath + DIR_SEPARATOR_STR + deviceId + DIR_SEPARATOR_STR + ss.str() + std::string crlPath = crlsPath + DIR_SEPARATOR_STR + deviceId + DIR_SEPARATOR_STR + dht::toHex(crl->getNumber()) + ".crl"; file = fileutils::ofstream(crlPath, std::ios::trunc | std::ios::binary); if (!file.is_open()) { diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp index 6e1d910f3c..748557bcd5 100644 --- a/src/security/certstore.cpp +++ b/src/security/certstore.cpp @@ -388,14 +388,8 @@ CertificateStore::pinRevocationList(const std::string& id, void CertificateStore::pinRevocationList(const std::string& id, const dht::crypto::RevocationList& crl) { - auto v = crl.getNumber(); - std::stringstream ss; - ss << std::hex; - for (const auto& b : v) - ss << (unsigned) b; - fileutils::check_dir((crlPath_ + DIR_SEPARATOR_CH + id).c_str()); - fileutils::saveFile(crlPath_ + DIR_SEPARATOR_CH + id + DIR_SEPARATOR_CH + ss.str(), + fileutils::saveFile(crlPath_ + DIR_SEPARATOR_CH + id + DIR_SEPARATOR_CH + dht::toHex(crl.getNumber()), crl.getPacked()); } -- GitLab