diff options
author | Saturneric <[email protected]> | 2021-06-02 19:13:57 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-06-02 19:13:57 +0000 |
commit | 2ce221a7f0a26c24b6cbe4c95703152288da906f (patch) | |
tree | 05ffe43c65bb0d33a6077287d3037857f311de6a /src/gpg/GpgContext.cpp | |
parent | Write a text logo for never expiring. (diff) | |
download | GpgFrontend-2ce221a7f0a26c24b6cbe4c95703152288da906f.tar.gz GpgFrontend-2ce221a7f0a26c24b6cbe4c95703152288da906f.zip |
Add and change the expiration date of the key pair.
Add a window to change the key expiration date.
Add a refresh mechanism for the key details tab.
Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | src/gpg/GpgContext.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gpg/GpgContext.cpp b/src/gpg/GpgContext.cpp index d4736249..d6211616 100644 --- a/src/gpg/GpgContext.cpp +++ b/src/gpg/GpgContext.cpp @@ -1048,6 +1048,31 @@ namespace GpgME { } } + bool GpgContext::setExpire(const GpgKey &key, const GpgSubKey *subkey, QDateTime *expires) { + unsigned long expires_time = 0; + if(expires != nullptr) { + qDebug() << "Expire Datetime" << expires->toString(); + expires_time = QDateTime::currentDateTime().secsTo(*expires); + } + + const char *subfprs = nullptr; + + if(subkey != nullptr) { + subfprs = subkey->fpr.toUtf8().constData(); + } + + auto gpgmeError = gpgme_op_setexpire(mCtx, key.key_refer, + expires_time, subfprs, 0); + if(gpgmeError == GPG_ERR_NO_ERROR) { + emit signalKeyUpdated(key.id); + return true; + } + else { + checkErr(gpgmeError); + return false; + } + } + } |