aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/model/GpgKeyGenerateInfo.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-18 17:11:40 +0000
committersaturneric <[email protected]>2025-04-18 17:11:40 +0000
commit502a43488d51c88be33d95be11ba8f160c2a3fd4 (patch)
tree87ee50bc5fdb1ca89d71ccfc988b1e6f67550f83 /src/core/model/GpgKeyGenerateInfo.cpp
parentfeat: add more info check (diff)
downloadGpgFrontend-502a43488d51c88be33d95be11ba8f160c2a3fd4.tar.gz
GpgFrontend-502a43488d51c88be33d95be11ba8f160c2a3fd4.zip
feat: add more basic env checks at init
Diffstat (limited to 'src/core/model/GpgKeyGenerateInfo.cpp')
-rw-r--r--src/core/model/GpgKeyGenerateInfo.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/core/model/GpgKeyGenerateInfo.cpp b/src/core/model/GpgKeyGenerateInfo.cpp
index b1dcaa7a..0d8aa23c 100644
--- a/src/core/model/GpgKeyGenerateInfo.cpp
+++ b/src/core/model/GpgKeyGenerateInfo.cpp
@@ -30,8 +30,9 @@
#include <cassert>
-#include "module/ModuleManager.h"
-#include "utils/CommonUtils.h"
+#include "core/module/ModuleManager.h"
+#include "core/utils/CommonUtils.h"
+#include "core/utils/GpgUtils.h"
namespace GpgFrontend {
@@ -98,14 +99,12 @@ const QContainer<KeyAlgo> KeyGenerateInfo::kSubKeyAlgos = {
{"elg4096", "ELG-E", "ELG-E", 4096, kENCRYPT, "2.2.0"},
};
-auto KeyGenerateInfo::GetSupportedKeyAlgo() -> QContainer<KeyAlgo> {
- const auto gnupg_version = Module::RetrieveRTValueTypedOrDefault<>(
- "core", "gpgme.ctx.gnupg_version", QString{"2.0.0"});
-
+auto KeyGenerateInfo::GetSupportedKeyAlgo(int channel) -> QContainer<KeyAlgo> {
QContainer<KeyAlgo> algos;
for (const auto &algo : kPrimaryKeyAlgos) {
- if (!algo.IsSupported(gnupg_version)) continue;
+ if (!CheckGpgVersion(channel, algo.SupportedVersion())) continue;
+
algos.append(algo);
}
@@ -116,14 +115,13 @@ auto KeyGenerateInfo::GetSupportedKeyAlgo() -> QContainer<KeyAlgo> {
return algos;
}
-auto KeyGenerateInfo::GetSupportedSubkeyAlgo() -> QContainer<KeyAlgo> {
- const auto gnupg_version = Module::RetrieveRTValueTypedOrDefault<>(
- "core", "gpgme.ctx.gnupg_version", QString{"2.0.0"});
-
+auto KeyGenerateInfo::GetSupportedSubkeyAlgo(int channel)
+ -> QContainer<KeyAlgo> {
QContainer<KeyAlgo> algos;
for (const auto &algo : kSubKeyAlgos) {
- if (!algo.IsSupported(gnupg_version)) continue;
+ if (!CheckGpgVersion(channel, algo.SupportedVersion())) continue;
+
algos.append(algo);
}
@@ -490,9 +488,7 @@ auto KeyAlgo::CanAuth() const -> bool { return auth_; }
auto KeyAlgo::CanCert() const -> bool { return cert_; }
-auto KeyAlgo::IsSupported(const QString &version) const -> bool {
- return GFCompareSoftwareVersion(version, supported_version_) >= 0;
-}
+auto KeyAlgo::SupportedVersion() const -> QString { return supported_version_; }
auto KeyAlgo::operator==(const KeyAlgo &o) const -> bool {
return this->id_ == o.id_;