diff options
author | Tobias Fella <[email protected]> | 2023-12-13 14:55:55 +0000 |
---|---|---|
committer | Tobias Fella <[email protected]> | 2023-12-13 15:43:22 +0000 |
commit | e18c09cbc4f004bf82b793a9fd983c7275d49b45 (patch) | |
tree | 850cfb85c52ab2f563221cf369b78a620778f150 | |
parent | core: percent decode filename (diff) | |
download | gpgme-tobias/fix-expires.tar.gz gpgme-tobias/fix-expires.zip |
qt: Fix validity for (sub)keys generated using QGpgMEQuickJobtobias/fix-expires
* lang/qt/src/qgpgmequickjob.cpp: Fix expiration calculation
--
The job calculates the validity as the seconds since epoch,
while GPG expects the seconds since the current time.
This leads to the validity being significantly longer than expected.
GnuPG-Bug-Id: 6889
-rw-r--r-- | lang/qt/src/qgpgmequickjob.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lang/qt/src/qgpgmequickjob.cpp b/lang/qt/src/qgpgmequickjob.cpp index e29be913..33f1178a 100644 --- a/lang/qt/src/qgpgmequickjob.cpp +++ b/lang/qt/src/qgpgmequickjob.cpp @@ -64,7 +64,8 @@ static QGpgMEQuickJob::result_type createWorker(GpgME::Context *ctx, auto err = ctx->createKey(uid.toUtf8().constData(), algo, 0, - expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000) : 0, + expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000 + - QDateTime::currentSecsSinceEpoch()) : 0, key, flags); return std::make_tuple(err, QString(), Error()); @@ -77,7 +78,8 @@ static QGpgMEQuickJob::result_type addSubkeyWorker(GpgME::Context *ctx, unsigned int flags) { auto err = ctx->createSubkey(key, algo, 0, - expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000): 0, + expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000 + - QDateTime::currentSecsSinceEpoch()): 0, flags); return std::make_tuple(err, QString(), Error()); } |