diff options
author | Saturneric <[email protected]> | 2021-12-06 15:58:23 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-06 15:58:43 +0000 |
commit | 97d13004e4f1cb33941a9be57c7e7662e223890b (patch) | |
tree | 6bf2466046379fd8ac2a0e9ca3605e15dce4672d /src/gpg/function/GpgKeyOpera.cpp | |
parent | Merge branch 'develop' of github.com:saturneric/GpgFrontend into develop-ci (diff) | |
download | GpgFrontend-97d13004e4f1cb33941a9be57c7e7662e223890b.tar.gz GpgFrontend-97d13004e4f1cb33941a9be57c7e7662e223890b.zip |
Improve UI & Functions
Diffstat (limited to '')
-rw-r--r-- | src/gpg/function/GpgKeyOpera.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gpg/function/GpgKeyOpera.cpp b/src/gpg/function/GpgKeyOpera.cpp index c60f9157..d0172a31 100644 --- a/src/gpg/function/GpgKeyOpera.cpp +++ b/src/gpg/function/GpgKeyOpera.cpp @@ -214,4 +214,23 @@ GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::GenerateSubkey( auto err = gpgme_op_createsubkey(ctx, gpgme_key_t(key), algo, 0, expires, flags); return check_gpg_error(err); -}
\ No newline at end of file +} + +GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::ModifyPassword( + const GpgFrontend::GpgKey& key) { + if (ctx.GetInfo().GnupgVersion < "2.0.15") { + LOG(ERROR) << _("operator not support"); + return GPG_ERR_NOT_SUPPORTED; + } + auto err = gpgme_op_passwd(ctx, gpgme_key_t(key), 0); + return check_gpg_error(err); +} +GpgFrontend::GpgError GpgFrontend::GpgKeyOpera::ModifyTOFUPolicy( + const GpgFrontend::GpgKey& key, gpgme_tofu_policy_t tofu_policy) { + if (ctx.GetInfo().GnupgVersion < "2.1.10") { + LOG(ERROR) << _("operator not support"); + return GPG_ERR_NOT_SUPPORTED; + } + auto err = gpgme_op_tofu_policy(ctx, gpgme_key_t(key), tofu_policy); + return check_gpg_error(err); +} |