changeset 1368:41cf49df007d

(issue179) Add signature timestamp in linux installer packages
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 24 Nov 2014 14:04:34 +0100
parents e7a8ec3185f2
children 948f03bb5254
files ui/createinstallerdialog.cpp
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);

http://wald.intevation.org/projects/trustbridge/