diff ui/createcertlistdialog.cpp @ 1390:f3e2df6b49ba

(issue181) Fix hardcoded values for RSA codesigning key size.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 19 Jan 2015 15:42:20 +0100
parents d009da9cfa10
children
line wrap: on
line diff
--- a/ui/createcertlistdialog.cpp	Thu Jan 15 16:46:36 2015 +0100
+++ b/ui/createcertlistdialog.cpp	Mon Jan 19 15:42:20 2015 +0100
@@ -9,6 +9,8 @@
 #include "sslhelp.h"
 #include "administratorwindow.h"
 
+#include "pubkey.h"
+
 #include <QDebug>
 #include <QMessageBox>
 #include <QDir>
@@ -142,10 +144,11 @@
         return;
     }
 
-    /* Check that it is a 3072 bit RSA key as specified */
-    if (!mPk->pk_info || pk_get_size(mPk) != 3072 ||
+    /* Check that it is a RSA key of the specified size */
+    if (!mPk->pk_info || pk_get_size(mPk) != TRUSTBRIDGE_RSA_KEY_SIZE ||
             mPk->pk_info->type != POLARSSL_PK_RSA) {
-        showErrorMessage(tr("Only 3072 bit RSA keys are supported by the current format."));
+        showErrorMessage(tr("Only %1 bit RSA keys are supported by the current format.").arg(
+                    TRUSTBRIDGE_RSA_KEY_SIZE));
         pk_free(mPk);
         delete mPk;
         mPk = NULL;
@@ -198,7 +201,7 @@
     }
 
     QByteArray signature = rsaSignSHA256Hash(sha256sum(listData), pk);
-    if (signature.size() != 3072 / 8) {
+    if (signature.size() != TRUSTBRIDGE_RSA_KEY_SIZE / 8) {
         qDebug() << "Signature creation returned signature of invalid size.";
         return false;
     }

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