[PATCH 3 of 3] (issue179) Add signature timestamp in linux installer packages

Wald Commits scm-commit at wald.intevation.org
Mon Nov 24 14:04:40 CET 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1416834274 -3600
# Node ID 41cf49df007daf7226be880d8ad09d481fd87026
# Parent  e7a8ec3185f2f4db131d2a2f3204afcdb958d798
(issue179) Add signature timestamp in linux installer packages

diff -r e7a8ec3185f2 -r 41cf49df007d ui/createinstallerdialog.cpp
--- a/ui/createinstallerdialog.cpp	Mon Nov 24 14:03:47 2014 +0100
+++ b/ui/createinstallerdialog.cpp	Mon Nov 24 14:04:34 2014 +0100
@@ -23,6 +23,7 @@
 #include <QApplication>
 #include <QMessageBox>
 #include <QTemporaryDir>
+#include <QDateTime>
 
 #include <polarssl/pk.h>
 
@@ -493,9 +494,17 @@
         return false;
     }
 
-    const QByteArray inputContent = inFile.readAll(); // Memory is cheap :)
+    QByteArray inputContent = inFile.readAll(); // Memory is cheap :)
     inFile.close();
 
+
+    /* Append the current date time to the signed data so that it is also signed.
+     * Until 2106 qt will probably return an 64 bit int on toTime_t. If not
+     * I'm sorry. */
+    QString sign_dt = QString("%1").arg(QDateTime::currentDateTime().toTime_t());
+    inputContent.replace("###SIGNATURE_DATE###", sign_dt.toLocal8Bit().constData());
+    inputContent.append("\r\nS_DT:" + sign_dt);
+
     if (inputContent.isEmpty()) {
         showErrorMessage(tr("Failed to read input file: %1").arg(inFile.fileName()));
         pk_free(&pk);


More information about the Trustbridge-commits mailing list