diff options
| -rw-r--r-- | CryptLog.pro | 3 | ||||
| -rw-r--r-- | crypt/hybridcrypt.cpp | 10 | ||||
| -rw-r--r-- | crypt/hybridcrypt.h | 10 |
3 files changed, 21 insertions, 2 deletions
diff --git a/CryptLog.pro b/CryptLog.pro index eaa7502..f700754 100644 --- a/CryptLog.pro +++ b/CryptLog.pro @@ -26,3 +26,6 @@ HEADERS += mainwindow.h \ FORMS += mainwindow.ui \ passworddialog.ui \ publickeyimport.ui + +unix: CONFIG += link_pkgconfig +unix: PKGCONFIG += openssl diff --git a/crypt/hybridcrypt.cpp b/crypt/hybridcrypt.cpp index 199c513..b197f75 100644 --- a/crypt/hybridcrypt.cpp +++ b/crypt/hybridcrypt.cpp @@ -2,13 +2,14 @@ HybridCrypt::HybridCrypt() { - + // Teste ob der Zufallszahlengenerator initialisiert ist + qDebug() << "Zufallszahlengenerator wurde erfolgreich initialisiert: " << isCsprngSeeded(); } void HybridCrypt::encrypt(QString infileName, QString outfileName, QVector<QString> recipientKeyfileNames) { - + qDebug() << "Zufallszahlengenerator wurde ausreichend geseeded: " << isCsprngSeeded(); } void HybridCrypt::decrypt(QString infileName, QString outfileName) @@ -36,3 +37,8 @@ void HybridCrypt::exportPublicUserKey(QString keyfileName) } +bool HybridCrypt::isCsprngSeeded() +{ + return RAND_status() == 1; +} + diff --git a/crypt/hybridcrypt.h b/crypt/hybridcrypt.h index d2a3b34..710cf47 100644 --- a/crypt/hybridcrypt.h +++ b/crypt/hybridcrypt.h @@ -5,8 +5,11 @@ #include <QFile> #include <QString> #include <QVector> +#include <QDebug> #include <openssl/evp.h> +#include <openssl/err.h> +#include <openssl/rand.h> class HybridCrypt { @@ -70,6 +73,13 @@ public: private: EVP_PKEY privateUserkey; EVP_PKEY publicUserkey; + + /** + * @brief isCsprngSeeded + * Gibt an, ob der Zufallszahlengenerator von OpenSSL mit ausreichend Entropie initialisiert wurde. + * @return Gibt wahr zurück wenn ausreichend intialisert wurde, ansonsten falsch. + */ + bool isCsprngSeeded(); }; #endif // HYBRIDCRYPT_H |
