X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcipher.h;h=01cf9ddc60656d51e1926f880f94c3cbfebd6a3f;hp=b5cf0e0f345c64fcbb5ee3b8500712b2dc9b68a9;hb=4e40c486dea949244b73beaf73d5ceb1ef591b5b;hpb=6f0a153a674317d77233139fc50a2985af86e36e diff --git a/src/core/cipher.h b/src/core/cipher.h index b5cf0e0f..01cf9ddc 100644 --- a/src/core/cipher.h +++ b/src/core/cipher.h @@ -15,14 +15,13 @@ #ifndef CIPHER_H #define CIPHER_H -#include +#include class Cipher { - public: +public: Cipher(); - explicit Cipher(QByteArray key, QString cipherType=QString("blowfish")); - ~Cipher(); + explicit Cipher(QByteArray key, QString cipherType = QString("blowfish")); QByteArray decrypt(QByteArray cipher); QByteArray decryptTopic(QByteArray cipher); bool encrypt(QByteArray& cipher); @@ -31,11 +30,13 @@ class Cipher bool parseFinishKeyX(QByteArray key); bool setKey(QByteArray key); QByteArray key() { return m_key; } - bool setType(const QString &type); + bool setType(const QString& type); QString type() { return m_type; } + static bool neededFeaturesAvailable(); + inline bool usesCBC() { return m_cbc; } - private: - //direction is true for encrypt, false for decrypt +private: + // direction is true for encrypt, false for decrypt QByteArray blowfishCBC(QByteArray cipherText, bool direction); QByteArray blowfishECB(QByteArray cipherText, bool direction); QByteArray b64ToByte(QByteArray text); @@ -48,4 +49,5 @@ class Cipher QString m_type; bool m_cbc; }; -#endif // CIPHER_H + +#endif // CIPHER_H