diff options
author | Saturneric <[email protected]> | 2022-11-26 18:10:31 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-11-26 18:10:31 +0000 |
commit | 534a64f2a6b550b5147ec646a704f936b3df887f (patch) | |
tree | 6fc03a8d78151cb9971dc49332ae64e344699114 /src | |
parent | feat: support generate ecc key (diff) | |
download | GpgFrontend-534a64f2a6b550b5147ec646a704f936b3df887f.tar.gz GpgFrontend-534a64f2a6b550b5147ec646a704f936b3df887f.zip |
fix: solve a crash issue
Diffstat (limited to 'src')
-rw-r--r-- | src/core/GpgGenKeyInfo.cpp | 31 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyGetter.cpp | 3 |
2 files changed, 24 insertions, 10 deletions
diff --git a/src/core/GpgGenKeyInfo.cpp b/src/core/GpgGenKeyInfo.cpp index 84c72f10..f9065529 100644 --- a/src/core/GpgGenKeyInfo.cpp +++ b/src/core/GpgGenKeyInfo.cpp @@ -41,7 +41,6 @@ void GpgFrontend::GenKeyInfo::SetAlgo( LOG(INFO) << "set algo name" << m_algo.first; // Check algo if supported std::string algo_args = m_algo.second; - boost::algorithm::to_upper(algo_args); if (standalone_) { if (!subkey_) { auto support_algo = GetSupportedKeyAlgoStandalone(); @@ -156,7 +155,22 @@ void GpgFrontend::GenKeyInfo::SetAlgo( suggest_max_key_size_ = -1; suggest_size_addition_step_ = -1; SetKeyLength(-1); + } else if (algo_args == "brainpoolp256r1") { + SetAllowAuthentication(false); + allow_change_authentication_ = false; + + SetAllowSigning(false); + allow_change_signing_ = false; + + SetAllowCertification(false); + allow_change_certification_ = false; + + suggest_min_key_size_ = -1; + suggest_max_key_size_ = -1; + suggest_size_addition_step_ = -1; + SetKeyLength(-1); } + this->algo_ = algo_args; } @@ -237,12 +251,15 @@ const std::vector<GpgFrontend::GenKeyInfo::KeyGenAlgo> const std::vector<GpgFrontend::GenKeyInfo::KeyGenAlgo> &GpgFrontend::GenKeyInfo::GetSupportedSubkeyAlgo() { static const std::vector<GpgFrontend::GenKeyInfo::KeyGenAlgo> - support_subkey_algo = {{"RSA", "RSA"}, - {"DSA", "DSA"}, - {"ECDSA", "ED25519"}, - {"ECDH NIST P-256", "NISTP256"}, - {"ECDH NIST P-384", "NISTP384"}, - {"ECDH NIST P-521", "NISTP521"}}; + support_subkey_algo = { + {"RSA", "RSA"}, + {"DSA", "DSA"}, + {"ECDSA", "ED25519"}, + {"ECDH NIST P-256", "NISTP256"}, + {"ECDH NIST P-384", "NISTP384"}, + {"ECDH NIST P-521", "NISTP521"}, + // {"ECDH BrainPool P-256", "BRAINPOOlP256R1"} + }; return support_subkey_algo; } diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index 1932d919..571e8797 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -88,8 +88,6 @@ GpgFrontend::KeyLinkListPtr GpgFrontend::GpgKeyGetter::FetchKey() { auto keys_list = std::make_unique<GpgKeyLinkList>(); - LOG(INFO) << "cache address:" << &keys_cache_ << "object address" << this; - for (const auto& [key, value] : keys_cache_) { LOG(INFO) << "FetchKey Id:" << value.GetId(); keys_list->push_back(value.Copy()); @@ -140,7 +138,6 @@ void GpgFrontend::GpgKeyGetter::FlushKeyCache() { err = gpgme_op_keylist_end(ctx_); assert(check_gpg_error_2_err_code(err, GPG_ERR_EOF) == GPG_ERR_NO_ERROR); - } GpgFrontend::KeyListPtr GpgFrontend::GpgKeyGetter::GetKeys( |