aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/GpgContext.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-06-02 19:13:57 +0000
committerSaturneric <[email protected]>2021-06-02 19:13:57 +0000
commit2ce221a7f0a26c24b6cbe4c95703152288da906f (patch)
tree05ffe43c65bb0d33a6077287d3037857f311de6a /src/gpg/GpgContext.cpp
parentWrite a text logo for never expiring. (diff)
downloadGpgFrontend-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.cpp25
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;
+ }
+ }
+
}