comparison ui/createinstallerdialog.cpp @ 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 137a0686de7b
children c8a6a3e6bdeb
comparison
equal deleted inserted replaced
1367:e7a8ec3185f2 1368:41cf49df007d
21 #include <QSettings> 21 #include <QSettings>
22 #include <QStyle> 22 #include <QStyle>
23 #include <QApplication> 23 #include <QApplication>
24 #include <QMessageBox> 24 #include <QMessageBox>
25 #include <QTemporaryDir> 25 #include <QTemporaryDir>
26 #include <QDateTime>
26 27
27 #include <polarssl/pk.h> 28 #include <polarssl/pk.h>
28 29
29 /* Static information used in codesigning */ 30 /* Static information used in codesigning */
30 #ifndef SIGN_HASH 31 #ifndef SIGN_HASH
491 showErrorMessage(tr("Failed to open input file: %1").arg(inFile.fileName())); 492 showErrorMessage(tr("Failed to open input file: %1").arg(inFile.fileName()));
492 pk_free(&pk); 493 pk_free(&pk);
493 return false; 494 return false;
494 } 495 }
495 496
496 const QByteArray inputContent = inFile.readAll(); // Memory is cheap :) 497 QByteArray inputContent = inFile.readAll(); // Memory is cheap :)
497 inFile.close(); 498 inFile.close();
499
500
501 /* Append the current date time to the signed data so that it is also signed.
502 * Until 2106 qt will probably return an 64 bit int on toTime_t. If not
503 * I'm sorry. */
504 QString sign_dt = QString("%1").arg(QDateTime::currentDateTime().toTime_t());
505 inputContent.replace("###SIGNATURE_DATE###", sign_dt.toLocal8Bit().constData());
506 inputContent.append("\r\nS_DT:" + sign_dt);
498 507
499 if (inputContent.isEmpty()) { 508 if (inputContent.isEmpty()) {
500 showErrorMessage(tr("Failed to read input file: %1").arg(inFile.fileName())); 509 showErrorMessage(tr("Failed to read input file: %1").arg(inFile.fileName()));
501 pk_free(&pk); 510 pk_free(&pk);
502 return false; 511 return false;

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