From 9dd195ddd3bce8183a43f9653e7caec5dd0a23ee Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Tue, 15 Sep 2015 14:32:43 +0200 Subject: Nutze ein Enum zur leichteren ReturnCodeverwaltung --- crypt/hybridcrypt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crypt/hybridcrypt.cpp') diff --git a/crypt/hybridcrypt.cpp b/crypt/hybridcrypt.cpp index c408bf1..9c236cb 100644 --- a/crypt/hybridcrypt.cpp +++ b/crypt/hybridcrypt.cpp @@ -99,7 +99,7 @@ void HybridCrypt::importUserKeypair(QString keyfileName, QString password) // Datei existiert nicht if (keyfile == NULL) { - throw CryptException("Datei nicht gefunden: " + keyfileName.toStdString(), 1); + throw CryptException("Datei nicht gefunden: " + keyfileName.toStdString(), CryptException::FileNotFound); } // Ließ den Schlüssel des Nutzers ein @@ -129,7 +129,7 @@ void HybridCrypt::exportUserKeypair(QString keyfileName, QString password) if (keyfile == NULL) { throw CryptException("Konnte Datei nicht schreiben: " + - keyfileName.toStdString(), 1); + keyfileName.toStdString(), CryptException::FileNotWritable); } // Wenn password ein Leerstring ist, verschlüssele den privaten Schlüssel nicht @@ -158,7 +158,7 @@ void HybridCrypt::exportPublicUserKey(QString keyfileName) if (keyfile == NULL) { throw CryptException("Konnte Datei nicht schreiben: " + - keyfileName.toStdString(), 1); + keyfileName.toStdString(), CryptException::FileNotWritable); } int opensslReturnError = PEM_write_PUBKEY(keyfile, userKeypair); @@ -192,7 +192,7 @@ void HybridCrypt::throwOpenSslException() { QString errorMsg("OpenSSL Fehler. Fehlermeldung: "); errorMsg.append(ERR_error_string(ERR_get_error(), NULL)); - throw CryptException(errorMsg.toStdString(), 5); + throw CryptException(errorMsg.toStdString(), CryptException::OpenSslError); } void HybridCrypt::throwExceptionIfEvpKeyIsNotRsa(EVP_PKEY **key) @@ -200,7 +200,7 @@ void HybridCrypt::throwExceptionIfEvpKeyIsNotRsa(EVP_PKEY **key) if (!isKeyRsa(*key)) { freeEvpKey(key); - throw CryptException("Nur RSA Schlüssel werden unterstüzt.", 6); + throw CryptException("Nur RSA Schlüssel werden unterstüzt.", CryptException::KeyNotRsa); } } -- cgit v1.2.3-70-g09d2