Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Cipher Class Reference

#include </tmp/quassel/src/core/cipher.h>

Public Member Functions

 Cipher ()
 Cipher (QByteArray key, QString cipherType=QString("blowfish"))
 ~Cipher ()
QByteArray decrypt (QByteArray cipher)
QByteArray decryptTopic (QByteArray cipher)
bool encrypt (QByteArray &cipher)
QByteArray initKeyExchange ()
QByteArray parseInitKeyX (QByteArray key)
bool parseFinishKeyX (QByteArray key)
bool setKey (QByteArray key)
QByteArray key ()
bool setType (const QString &type)
QString type ()
bool usesCBC ()

Static Public Member Functions

static bool neededFeaturesAvailable ()

Private Member Functions

QByteArray blowfishCBC (QByteArray cipherText, bool direction)
QByteArray blowfishECB (QByteArray cipherText, bool direction)
QByteArray b64ToByte (QByteArray text)
QByteArray byteToB64 (QByteArray text)

Private Attributes

QCA::Initializer init
QByteArray m_key
QCA::DHPrivateKey m_tempKey
QCA::BigInteger m_primeNum
QString m_type
bool m_cbc

Detailed Description

Definition at line 20 of file cipher.h.

Constructor & Destructor Documentation

Cipher ( )

Definition at line 18 of file cipher.cpp.

References m_primeNum, and setType().

Cipher ( QByteArray  key,
QString  cipherType = QString("blowfish") 
)
explicit

Definition at line 25 of file cipher.cpp.

References m_primeNum, setKey(), and setType().

~Cipher ( )

Definition at line 33 of file cipher.cpp.

Member Function Documentation

QByteArray decrypt ( QByteArray  cipher)

Definition at line 74 of file cipher.cpp.

References blowfishCBC(), blowfishECB(), and m_cbc.

Referenced by IrcParser::decrypt().

QByteArray decryptTopic ( QByteArray  cipher)

Definition at line 250 of file cipher.cpp.

References blowfishCBC(), blowfishECB(), and m_cbc.

Referenced by IrcParser::decrypt().

bool encrypt ( QByteArray &  cipher)

Definition at line 281 of file cipher.cpp.

References blowfishCBC(), blowfishECB(), and m_cbc.

Referenced by CoreUserInputHandler::putPrivmsg().

QByteArray initKeyExchange ( )

Definition at line 152 of file cipher.cpp.

References init, m_primeNum, and m_tempKey.

Referenced by CoreUserInputHandler::handleKeyx().

QByteArray parseInitKeyX ( QByteArray  key)

Definition at line 170 of file cipher.cpp.

References init, m_primeNum, and setKey().

bool parseFinishKeyX ( QByteArray  key)

Definition at line 220 of file cipher.cpp.

References init, m_primeNum, m_tempKey, and setKey().

bool setKey ( QByteArray  key)

Definition at line 36 of file cipher.cpp.

References key(), m_cbc, and m_key.

Referenced by Cipher(), parseFinishKeyX(), and parseInitKeyX().

QByteArray key ( )
inline

Definition at line 33 of file cipher.h.

References m_key.

Referenced by IrcParser::decrypt(), CoreUserInputHandler::putPrivmsg(), and setKey().

bool setType ( const QString &  type)

Definition at line 66 of file cipher.cpp.

References m_type, and type().

Referenced by Cipher().

QString type ( )
inline

Definition at line 35 of file cipher.h.

References m_type.

Referenced by setType().

bool usesCBC ( )
inline

Definition at line 37 of file cipher.h.

References m_cbc.

QByteArray blowfishCBC ( QByteArray  cipherText,
bool  direction 
)
private

Definition at line 317 of file cipher.cpp.

References init, m_key, and m_type.

Referenced by decrypt(), decryptTopic(), and encrypt().

QByteArray blowfishECB ( QByteArray  cipherText,
bool  direction 
)
private

Definition at line 355 of file cipher.cpp.

References b64ToByte(), byteToB64(), init, m_key, and m_type.

Referenced by decrypt(), decryptTopic(), and encrypt().

QByteArray b64ToByte ( QByteArray  text)
private

Definition at line 446 of file cipher.cpp.

Referenced by blowfishECB().

QByteArray byteToB64 ( QByteArray  text)
private

Definition at line 396 of file cipher.cpp.

Referenced by blowfishECB().

Member Data Documentation

QCA::Initializer init
private
QByteArray m_key
private

Definition at line 47 of file cipher.h.

Referenced by blowfishCBC(), blowfishECB(), key(), and setKey().

QCA::DHPrivateKey m_tempKey
private

Definition at line 48 of file cipher.h.

Referenced by initKeyExchange(), and parseFinishKeyX().

QCA::BigInteger m_primeNum
private

Definition at line 49 of file cipher.h.

Referenced by Cipher(), initKeyExchange(), parseFinishKeyX(), and parseInitKeyX().

QString m_type
private

Definition at line 50 of file cipher.h.

Referenced by blowfishCBC(), blowfishECB(), setType(), and type().

bool m_cbc
private

Definition at line 51 of file cipher.h.

Referenced by decrypt(), decryptTopic(), encrypt(), setKey(), and usesCBC().


The documentation for this class was generated from the following files: