Commit f09588c3 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Treat creation and expiration times as unsigned 32-bit numbers

All time fields in OpenPGP are unsigned four-octet numbers, but gpgme
uses time_t which might be a signed 32-bit number.
parent 4662d151
......@@ -261,7 +261,7 @@ void ChangeExpiryCommand::doStart()
Q_ASSERT(d->dialog);
const Subkey subkey = !d->subkey.isNull() ? d->subkey : d->key.subkey(0);
d->dialog->setDateOfExpiry(subkey.neverExpires() ? QDate() :
QDateTime::fromSecsSinceEpoch(subkey.expirationTime()).date());
QDateTime::fromSecsSinceEpoch(quint32(subkey.expirationTime())).date());
#ifdef QGPGME_SUPPORTS_CHANGING_EXPIRATION_OF_COMPLETE_KEY
if (mode == ExpiryDialog::Mode::UpdateCertificateWithSubkeys) {
d->dialog->setUpdateExpirationOfAllSubkeys(allNotRevokedSubkeysHaveSameExpirationAsPrimaryKey(d->key));
......
......@@ -258,7 +258,7 @@ void KeyToCardCommand::Private::startKeyToOpenPGPCard() {
}
// Now do the deed
const auto time = QDateTime::fromSecsSinceEpoch(subkey.creationTime(), Qt::UTC);
const auto time = QDateTime::fromSecsSinceEpoch(quint32(subkey.creationTime()), Qt::UTC);
const auto timestamp = time.toString(QStringLiteral("yyyyMMdd'T'HHmmss"));
const QString cmd = QStringLiteral("KEYTOCARD --force %1 %2 OPENPGP.%3 %4")
.arg(QString::fromLatin1(subkey.keyGrip()), QString::fromStdString(serialNumber()))
......
......@@ -260,7 +260,7 @@ static QString formatSigningInformation(const Signature &sig)
if (sig.isNull()) {
return QString();
}
const QDateTime dt = sig.creationTime() != 0 ? QDateTime::fromSecsSinceEpoch(sig.creationTime()) : QDateTime();
const QDateTime dt = sig.creationTime() != 0 ? QDateTime::fromSecsSinceEpoch(quint32(sig.creationTime())) : QDateTime();
QString text;
Key key = sig.key();
if (dt.isValid()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment