# HG changeset patch # User Andre Heinecke # Date 1421678540 -3600 # Node ID f3e2df6b49bae98facc0c30278bc8a6f61d17d3d # Parent c64b6c56ce96e1b01095bb54bafe23273ab80598 (issue181) Fix hardcoded values for RSA codesigning key size. diff -r c64b6c56ce96 -r f3e2df6b49ba common/binverify.c --- a/common/binverify.c Thu Jan 15 16:46:36 2015 +0100 +++ b/common/binverify.c Mon Jan 19 15:42:20 2015 +0100 @@ -11,11 +11,7 @@ #include "strhelp.h" #include "logging.h" #include "listutil.h" -#ifdef RELEASE_BUILD -#include "pubkey-release.h" -#else -#include "pubkey-test.h" -#endif +#include "pubkey.h" bin_verify_result verify_binary(const char *filename, size_t name_len) diff -r c64b6c56ce96 -r f3e2df6b49ba common/pubkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/pubkey.h Mon Jan 19 15:42:20 2015 +0100 @@ -0,0 +1,10 @@ +#ifndef PUBKEY_H +#define PUBKEY_H + +#ifdef RELEASE_BUILD +#include "pubkey-release.h" +#else +#include "pubkey-test.h" +#endif + +#endif // PUBKEY_H diff -r c64b6c56ce96 -r f3e2df6b49ba ui/createcertlistdialog.cpp --- 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 #include #include @@ -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; } diff -r c64b6c56ce96 -r f3e2df6b49ba ui/createinstallerdialog.cpp --- a/ui/createinstallerdialog.cpp Thu Jan 15 16:46:36 2015 +0100 +++ b/ui/createinstallerdialog.cpp Mon Jan 19 15:42:20 2015 +0100 @@ -7,6 +7,7 @@ */ #include "createinstallerdialog.h" #include "sslhelp.h" +#include "pubkey.h" #include #include @@ -524,15 +525,16 @@ return false; } - /* Check that it is a 3072 bit RSA key as specified */ - if (!pk.pk_info || pk_get_size(&pk) != 3072 || + /* Check that it is an RSA key that matches the size */ + if (!pk.pk_info || pk_get_size(&pk) != TRUSTBRIDGE_RSA_CODESIGN_SIZE || pk.pk_info->type != POLARSSL_PK_RSA) { if (pk.pk_info) { qDebug() << pk.pk_info->type << "type"; } qDebug() << POLARSSL_PK_RSA << "rsa"; qDebug() << "size " << pk_get_size(&pk); - 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_CODESIGN_SIZE)); pk_free(&pk); return false; } @@ -563,7 +565,7 @@ const QByteArray signature = rsaSignSHA256Hash(sha256sum(inputContent), &pk); pk_free(&pk); - if (signature.size() != 3072 / 8) { + if (signature.size() != TRUSTBRIDGE_RSA_CODESIGN_SIZE / 8) { qDebug() << "Signature creation returned signature of invalid size."; return false; } diff -r c64b6c56ce96 -r f3e2df6b49ba ui/l10n/administrator_de_DE.ts --- a/ui/l10n/administrator_de_DE.ts Thu Jan 15 16:46:36 2015 +0100 +++ b/ui/l10n/administrator_de_DE.ts Mon Jan 19 15:42:20 2015 +0100 @@ -260,111 +260,115 @@ CreateCertListDialog - - + + Save certificate list Zertifikatsliste speichern - + Save all managed root certificates in a new, signed certificate list. Eine neue, signierte Zertifikatsliste erstellen. - + In addition, each certificate list will be saved automatically in the archive directory: Zusätzlich wird jede Zertifikatsliste automatisch in diesem Ordner Archiviert: - + Save list Liste speichern - + Cancel Abbrechen - + Error! Fehler! - + + Only %1 bit RSA keys are supported by the current format. + + + + Select certificate Zertifikat auswählen - + Failed to write list to: %1 Fehler beim schreiben der Liste in Datei: %1 - + Failed to load certificate: %1 English wording is wrong Fehler beim laden des Schlüssels: %1 - + Select signing key: Signaturschlüssel auswählen: - + Select output folder: Ausgabeverzeichnis auswählen: - Only 3072 bit RSA keys are supported by the current format. - Nur 3027 bit RSA Schlüssel werden vom aktuellen Format unterstützt. + Nur 3027 bit RSA Schlüssel werden vom aktuellen Format unterstützt. - + Select target location Zielordner auswählen - + Please select a valid rsa key. Kein Signaturschlüssel ausgewählt. - + Please select an output location first. Kein Zielordner angegeben. - + Failed to create archive location. Fehler beim erstellen des Archivordners. - + Failed Archive a copy. Fehler beim speichern der Archivkopie. - + Failed to update current_certificates.txt Fehler beim Aktualisieren von current_certificates.txt - + Failed to write current_certificates file. Fehler beim schreiben der Datei "current_certificates". - + Failed to calculate key hash. Fehler bei der Berechnung des Schlüsselfingerabdrucks. - + Saved certificate list: %1 Zertifikatsliste gespeichert: %1 @@ -373,58 +377,58 @@ CreateInstallerDialog - - + + Create binary installer Installationspaket erstellen - + Create and sign a TrustBridge binary installer. Erzeugt und signiert ein TrustBridge-Installationspaket. - + Select binary folder: Binärverzeichnis auswählen: - + Select code signing certificate: Code-Signing-Zertifikat auswählen: - + Select output folder: Ausgabeverzeichnis auswählen: - + Create installer Installationspaket erzeugen - + Cancel Abbrechen - + Creating installer package... Installationspaket wird erstellt... - + Select certificate Zertifikat auswählen - + Select binary folder Binärverzeichnis auswählen - + Error! Fehler! @@ -433,141 +437,145 @@ Installationspaket erstellt in %1. - + Signing installer package... Installationspaket signieren... - + Failed to sign installer package. Fehler beim Signieren des Installationspakets. - + Please select an existing input folder. Bitte wählen Sie ein existierendes Eingabeverzeichnis. - + Please select a codesigning certificate. Bitte wählen Sie ein Code-Signing-Zertifikat. - + Please select a output folder. Bitte wählen Sie ein Ausgabeverzeichnis. - + Folder %1 does not appear to contain a meta.ini Das Verzeichnis %1 enthält keine meta.ini Datei - + Failed to find the directory for linux binaries: %1 Verzeichnis der Linux Anwendung '%1' konnte nicht gefunden werden. - + Failed to find a readable *.sh file in: %1 Keine lesbare *.sh Datei in '%1' gefunden. - + Failed to sign binaries with osslsigncode. Please check that %1 is a valid code signing certificate and that osslsigncode can be found in the PATH. Fehler beim Signieren der Binärpakete mit osslsigncode. Bitte prüfen Sie, dass %1 ein gültiges Code-Signing-Zertifikat ist und osslsigncode im PATH gefunden wird. - + Signing Linux package... Signieren des Linux Pakets... - + Calculating checksums... Prüfsummen berechnen... - + Checksums: Prüfsummen: - + Failed to open file "%1". Die Datei "%1" konnte nicht geöffnet werden. - + Failed to read file "%1". Die Datei "%1" konnte nicht gelesen werden. - + Failed to calculate checksums for "%1". Die Prüfsumme für "%1" konnte nicht berechnet werden. - + Successfully created the installation packages in "%1". Die Installationspakete wurden erfolgreich im Ordner: "%1" erstellt. - + Failed to sign linux package: %1 Fehler beim signieren des Linux Paketes: %1 - + Creating NSIS package... NSIS-Paket wird erstellt... - + Failed to find installer script at: %1 Installer skript konnte nicht unter: %1 gefunden werden - + Failed to start makensis. Please ensure that makensis is installed and in your PATH variable. Fehler beim Starten von makensis. Bitte versichern Sie sich, dass makensis korrekt installiert und in der PATH-Variable enthalten ist. - + Signing binaries... Binärpakete werden signiert... - + Failed to copy binaries to temporary location. Fehler beim Kopieren der Binärdaten in temporären Ort. - + Failed to load certificate: %1 Fehler beim laden des Schlüssels: %1 - - Only 3072 bit RSA keys are supported by the current format. - Nur 3072 bit RSA Schlüssel werden vom aktuellen Format unterstützt. + + Only %1 bit RSA keys are supported by the current format. + - + Only 3072 bit RSA keys are supported by the current format. + Nur 3072 bit RSA Schlüssel werden vom aktuellen Format unterstützt. + + + Failed to open input file: %1 Fehler beim öffnen der Datei: %1 - + Failed to read input file: %1 Fehler beim lesen der Datei: %1 - + Select target location Zielort auswählen @@ -575,22 +583,22 @@ FinishedDialog - + Successfully created installation package Installationspaket erfolgreich erstellt. - + Error! Fehler! - + Details Details - + OK OK diff -r c64b6c56ce96 -r f3e2df6b49ba ui/sslhelp.cpp --- a/ui/sslhelp.cpp Thu Jan 15 16:46:36 2015 +0100 +++ b/ui/sslhelp.cpp Mon Jan 19 15:42:20 2015 +0100 @@ -76,10 +76,5 @@ return QByteArray(); } - if (sig_len != 3072 / 8) { - qDebug() << "Invalid size of signature: " << sig_len; - return QByteArray(); - } - return QByteArray((const char *)sig, (int)sig_len); }