aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/KeyPackageOperator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function/KeyPackageOperator.cpp')
-rw-r--r--src/core/function/KeyPackageOperator.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp
index 3779c64b..5c917ab8 100644
--- a/src/core/function/KeyPackageOperator.cpp
+++ b/src/core/function/KeyPackageOperator.cpp
@@ -39,7 +39,7 @@ namespace GpgFrontend {
bool KeyPackageOperator::GeneratePassphrase(
const std::filesystem::path& phrase_path, std::string& phrase) {
phrase = PassphraseGenerator::GetInstance().Generate(256);
- LOG(INFO) << "Generated passphrase: " << phrase.size() << " bytes";
+ SPDLOG_DEBUG("generated passphrase: {} bytes", phrase.size());
return FileOperator::WriteFileStd(phrase_path, phrase);
}
@@ -47,12 +47,12 @@ bool KeyPackageOperator::GenerateKeyPackage(
const std::filesystem::path& key_package_path,
const std::string& key_package_name, KeyIdArgsListPtr& key_ids,
std::string& phrase, bool secret) {
- LOG(INFO) << "Generating key package: " << key_package_name;
+ SPDLOG_DEBUG("generating key package: {}", key_package_name);
ByteArrayPtr key_export_data = nullptr;
- if (!GpgKeyImportExporter::GetInstance().ExportKeys(key_ids, key_export_data,
- secret)) {
- LOG(ERROR) << "Failed to export keys";
+ if (!GpgKeyImportExporter::GetInstance().ExportAllKeys(
+ key_ids, key_export_data, secret)) {
+ SPDLOG_ERROR("failed to export keys");
return false;
}
@@ -64,7 +64,7 @@ bool KeyPackageOperator::GenerateKeyPackage(
QAESEncryption::Padding::ISO);
auto encoded = encryption.encode(data, hash_key);
- LOG(INFO) << "Writing key package: " << key_package_name;
+ SPDLOG_DEBUG("writing key package: {}", key_package_name);
return FileOperator::WriteFileStd(key_package_path, encoded.toStdString());
}
@@ -72,21 +72,21 @@ bool KeyPackageOperator::ImportKeyPackage(
const std::filesystem::path& key_package_path,
const std::filesystem::path& phrase_path,
GpgFrontend::GpgImportInformation& import_info) {
- LOG(INFO) << "Importing key package: " << key_package_path.u8string();
+ SPDLOG_DEBUG("importing key package: {]", key_package_path.u8string());
std::string encrypted_data;
FileOperator::ReadFileStd(key_package_path, encrypted_data);
if (encrypted_data.empty()) {
- LOG(ERROR) << "Failed to read key package: " << key_package_path.u8string();
+ SPDLOG_ERROR("failed to read key package: {}", key_package_path.u8string());
return false;
};
std::string passphrase;
FileOperator::ReadFileStd(phrase_path, passphrase);
- LOG(INFO) << "Passphrase: " << passphrase.size() << " bytes";
+ SPDLOG_DEBUG("passphrase: {} bytes", passphrase.size());
if (passphrase.size() != 256) {
- LOG(ERROR) << "Failed to read passphrase: " << phrase_path.u8string();
+ SPDLOG_ERROR("failed to read passphrase: {}", phrase_path.u8string());
return false;
}
@@ -100,7 +100,7 @@ bool KeyPackageOperator::ImportKeyPackage(
auto decoded = encryption.removePadding(encryption.decode(encoded, hash_key));
auto key_data = QByteArray::fromBase64(decoded);
- LOG(INFO) << "key data" << key_data.size();
+ SPDLOG_DEBUG("key data size: {}", key_data.size());
if (!key_data.startsWith(GpgConstants::PGP_PUBLIC_KEY_BEGIN) &&
!key_data.startsWith(GpgConstants::PGP_PRIVATE_KEY_BEGIN)) {
return false;