From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../groupwise/libgroupwise/qca/src/qca.cpp | 298 ++++++++++----------- .../protocols/groupwise/libgroupwise/qca/src/qca.h | 150 +++++------ .../groupwise/libgroupwise/qca/src/qcaprovider.h | 92 +++---- 3 files changed, 270 insertions(+), 270 deletions(-) (limited to 'kopete/protocols/groupwise/libgroupwise/qca') diff --git a/kopete/protocols/groupwise/libgroupwise/qca/src/qca.cpp b/kopete/protocols/groupwise/libgroupwise/qca/src/qca.cpp index e660ef42..10cae6b8 100644 --- a/kopete/protocols/groupwise/libgroupwise/qca/src/qca.cpp +++ b/kopete/protocols/groupwise/libgroupwise/qca/src/qca.cpp @@ -20,15 +20,15 @@ #include"qca.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include"qcaprovider.h" @@ -46,11 +46,11 @@ class ProviderItem { public: QCAProvider *p; - QString fname; + TQString fname; - static ProviderItem *load(const QString &fname) + static ProviderItem *load(const TQString &fname) { - QLibrary *lib = new QLibrary(fname); + TQLibrary *lib = new TQLibrary(fname); if(!lib->load()) { delete lib; return 0; @@ -92,10 +92,10 @@ public: } private: - QLibrary *lib; + TQLibrary *lib; bool init_done; - ProviderItem(QLibrary *_lib, QCAProvider *_p) + ProviderItem(TQLibrary *_lib, QCAProvider *_p) { lib = _lib; p = _p; @@ -103,12 +103,12 @@ private: } }; -static QPtrList providerList; +static TQPtrList providerList; static bool qca_init = false; -static bool plugin_have(const QString &fname) +static bool plugin_have(const TQString &fname) { - QPtrListIterator it(providerList); + TQPtrListIterator it(providerList); for(ProviderItem *i; (i = it.current()); ++it) { if(i->fname == fname) return true; @@ -118,21 +118,21 @@ static bool plugin_have(const QString &fname) static void plugin_scan() { - QStringList dirs = QApplication::libraryPaths(); - for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { - QDir libpath(*it); - QDir dir(libpath.filePath("crypto")); + TQStringList dirs = TQApplication::libraryPaths(); + for(TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { + TQDir libpath(*it); + TQDir dir(libpath.filePath("crypto")); if(!dir.exists()) continue; - QStringList list = dir.entryList(); - for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { - QFileInfo fi(dir.filePath(*it)); + TQStringList list = dir.entryList(); + for(TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { + TQFileInfo fi(dir.filePath(*it)); if(fi.isDir()) continue; if(fi.extension() != PLUGIN_EXT) continue; - QString fname = fi.filePath(); + TQString fname = fi.filePath(); // don't load the same plugin again! if(plugin_have(fname)) @@ -166,26 +166,26 @@ static void plugin_unloadall() static int plugin_caps() { int caps = 0; - QPtrListIterator it(providerList); + TQPtrListIterator it(providerList); for(ProviderItem *i; (i = it.current()); ++it) caps |= i->p->capabilities(); return caps; } -QString QCA::arrayToHex(const QByteArray &a) +TQString QCA::arrayToHex(const TQByteArray &a) { - QString out; + TQString out; for(int n = 0; n < (int)a.size(); ++n) { - QString str; + TQString str; str.sprintf("%02x", (uchar)a[n]); out.append(str); } return out; } -QByteArray QCA::hexToArray(const QString &str) +TQByteArray QCA::hexToArray(const TQString &str) { - QByteArray out(str.length() / 2); + TQByteArray out(str.length() / 2); int at = 0; for(int n = 0; n + 1 < (int)str.length(); n += 2) { uchar a = str[n]; @@ -239,7 +239,7 @@ static void *getContext(int cap) if(!QCA::isSupported(cap)) return 0; - QPtrListIterator it(providerList); + TQPtrListIterator it(providerList); for(ProviderItem *i; (i = it.current()); ++it) { if(i->p->capabilities() & cap) { i->ensureInit(); @@ -303,14 +303,14 @@ void Hash::clear() d->reset(); } -void Hash::update(const QByteArray &a) +void Hash::update(const TQByteArray &a) { d->c->update(a.data(), a.size()); } -QByteArray Hash::final() +TQByteArray Hash::final() { - QByteArray buf; + TQByteArray buf; d->c->final(&buf); return buf; } @@ -343,11 +343,11 @@ public: QCA_CipherContext *c; int dir; int mode; - QByteArray key, iv; + TQByteArray key, iv; bool err; }; -Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad) +Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) { d = new Private; d->c = c; @@ -377,27 +377,27 @@ Cipher::~Cipher() delete d; } -QByteArray Cipher::dyn_generateKey(int size) const +TQByteArray Cipher::dyn_generateKey(int size) const { - QByteArray buf; + TQByteArray buf; if(size != -1) buf.resize(size); else buf.resize(d->c->keySize()); if(!d->c->generateKey(buf.data(), size)) - return QByteArray(); + return TQByteArray(); return buf; } -QByteArray Cipher::dyn_generateIV() const +TQByteArray Cipher::dyn_generateIV() const { - QByteArray buf(d->c->blockSize()); + TQByteArray buf(d->c->blockSize()); if(!d->c->generateIV(buf.data())) - return QByteArray(); + return TQByteArray(); return buf; } -void Cipher::reset(int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad) +void Cipher::reset(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) { d->reset(); @@ -411,7 +411,7 @@ void Cipher::reset(int dir, int mode, const QByteArray &key, const QByteArray &i } } -bool Cipher::update(const QByteArray &a) +bool Cipher::update(const TQByteArray &a) { if(d->err) return false; @@ -425,17 +425,17 @@ bool Cipher::update(const QByteArray &a) return true; } -QByteArray Cipher::final(bool *ok) +TQByteArray Cipher::final(bool *ok) { if(ok) *ok = false; if(d->err) - return QByteArray(); + return TQByteArray(); - QByteArray out; + TQByteArray out; if(!d->c->final(&out)) { d->err = true; - return QByteArray(); + return TQByteArray(); } if(ok) *ok = true; @@ -473,7 +473,7 @@ MD5::MD5() //---------------------------------------------------------------------------- // BlowFish //---------------------------------------------------------------------------- -BlowFish::BlowFish(int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad) +BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) :Cipher((QCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad) { } @@ -482,7 +482,7 @@ BlowFish::BlowFish(int dir, int mode, const QByteArray &key, const QByteArray &i //---------------------------------------------------------------------------- // TripleDES //---------------------------------------------------------------------------- -TripleDES::TripleDES(int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad) +TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) :Cipher((QCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad) { } @@ -491,7 +491,7 @@ TripleDES::TripleDES(int dir, int mode, const QByteArray &key, const QByteArray //---------------------------------------------------------------------------- // AES128 //---------------------------------------------------------------------------- -AES128::AES128(int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad) +AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) :Cipher((QCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad) { } @@ -500,7 +500,7 @@ AES128::AES128(int dir, int mode, const QByteArray &key, const QByteArray &iv, b //---------------------------------------------------------------------------- // AES256 //---------------------------------------------------------------------------- -AES256::AES256(int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad) +AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) :Cipher((QCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad) { } @@ -564,35 +564,35 @@ bool RSAKey::havePrivate() const return d->c->havePrivate(); } -QByteArray RSAKey::toDER(bool publicOnly) const +TQByteArray RSAKey::toDER(bool publicOnly) const { - QByteArray out; + TQByteArray out; if(!d->c->toDER(&out, publicOnly)) - return QByteArray(); + return TQByteArray(); return out; } -bool RSAKey::fromDER(const QByteArray &a) +bool RSAKey::fromDER(const TQByteArray &a) { return d->c->createFromDER(a.data(), a.size()); } -QString RSAKey::toPEM(bool publicOnly) const +TQString RSAKey::toPEM(bool publicOnly) const { - QByteArray out; + TQByteArray out; if(!d->c->toPEM(&out, publicOnly)) - return QByteArray(); + return TQByteArray(); - QCString cs; + TQCString cs; cs.resize(out.size()+1); memcpy(cs.data(), out.data(), out.size()); - return QString::fromLatin1(cs); + return TQString::fromLatin1(cs); } -bool RSAKey::fromPEM(const QString &str) +bool RSAKey::fromPEM(const TQString &str) { - QCString cs = str.latin1(); - QByteArray a(cs.length()); + TQCString cs = str.latin1(); + TQByteArray a(cs.length()); memcpy(a.data(), cs.data(), a.size()); return d->c->createFromPEM(a.data(), a.size()); } @@ -602,18 +602,18 @@ bool RSAKey::fromNative(void *p) return d->c->createFromNative(p); } -bool RSAKey::encrypt(const QByteArray &a, QByteArray *b, bool oaep) const +bool RSAKey::encrypt(const TQByteArray &a, TQByteArray *b, bool oaep) const { - QByteArray out; + TQByteArray out; if(!d->c->encrypt(a, &out, oaep)) return false; *b = out; return true; } -bool RSAKey::decrypt(const QByteArray &a, QByteArray *b, bool oaep) const +bool RSAKey::decrypt(const TQByteArray &a, TQByteArray *b, bool oaep) const { - QByteArray out; + TQByteArray out; if(!d->c->decrypt(a, &out, oaep)) return false; *b = out; @@ -647,14 +647,14 @@ void RSA::setKey(const RSAKey &k) v_key = k; } -bool RSA::encrypt(const QByteArray &a, QByteArray *b, bool oaep) const +bool RSA::encrypt(const TQByteArray &a, TQByteArray *b, bool oaep) const { if(v_key.isNull()) return false; return v_key.encrypt(a, b, oaep); } -bool RSA::decrypt(const QByteArray &a, QByteArray *b, bool oaep) const +bool RSA::decrypt(const TQByteArray &a, TQByteArray *b, bool oaep) const { if(v_key.isNull()) return false; @@ -727,84 +727,84 @@ bool Cert::isNull() const return d->c->isNull(); } -QString Cert::commonName() const +TQString Cert::commonName() const { CertProperties props = subject(); return props["CN"]; } -QString Cert::serialNumber() const +TQString Cert::serialNumber() const { return d->c->serialNumber(); } -QString Cert::subjectString() const +TQString Cert::subjectString() const { return d->c->subjectString(); } -QString Cert::issuerString() const +TQString Cert::issuerString() const { return d->c->issuerString(); } CertProperties Cert::subject() const { - QValueList list = d->c->subject(); + TQValueList list = d->c->subject(); CertProperties props; - for(QValueList::ConstIterator it = list.begin(); it != list.end(); ++it) + for(TQValueList::ConstIterator it = list.begin(); it != list.end(); ++it) props[(*it).var] = (*it).val; return props; } CertProperties Cert::issuer() const { - QValueList list = d->c->issuer(); + TQValueList list = d->c->issuer(); CertProperties props; - for(QValueList::ConstIterator it = list.begin(); it != list.end(); ++it) + for(TQValueList::ConstIterator it = list.begin(); it != list.end(); ++it) props[(*it).var] = (*it).val; return props; } -QDateTime Cert::notBefore() const +TQDateTime Cert::notBefore() const { return d->c->notBefore(); } -QDateTime Cert::notAfter() const +TQDateTime Cert::notAfter() const { return d->c->notAfter(); } -QByteArray Cert::toDER() const +TQByteArray Cert::toDER() const { - QByteArray out; + TQByteArray out; if(!d->c->toDER(&out)) - return QByteArray(); + return TQByteArray(); return out; } -bool Cert::fromDER(const QByteArray &a) +bool Cert::fromDER(const TQByteArray &a) { return d->c->createFromDER(a.data(), a.size()); } -QString Cert::toPEM() const +TQString Cert::toPEM() const { - QByteArray out; + TQByteArray out; if(!d->c->toPEM(&out)) - return QByteArray(); + return TQByteArray(); - QCString cs; + TQCString cs; cs.resize(out.size()+1); memcpy(cs.data(), out.data(), out.size()); - return QString::fromLatin1(cs); + return TQString::fromLatin1(cs); } -bool Cert::fromPEM(const QString &str) +bool Cert::fromPEM(const TQString &str) { - QCString cs = str.latin1(); - QByteArray a(cs.length()); + TQCString cs = str.latin1(); + TQByteArray a(cs.length()); memcpy(a.data(), cs.data(), a.size()); return d->c->createFromPEM(a.data(), a.size()); } @@ -842,7 +842,7 @@ public: tryMore = false; } - void appendArray(QByteArray *a, const QByteArray &b) + void appendArray(TQByteArray *a, const TQByteArray &b) { int oldsize = a->size(); a->resize(oldsize + b.size()); @@ -851,21 +851,21 @@ public: Cert cert; QCA_TLSContext *c; - QByteArray in, out, to_net, from_net; + TQByteArray in, out, to_net, from_net; int bytesEncoded; bool tryMore; bool handshaken; - QString host; + TQString host; bool hostMismatch; bool closing; Cert ourCert; RSAKey ourKey; - QPtrList store; + TQPtrList store; }; -TLS::TLS(QObject *parent) -:QObject(parent) +TLS::TLS(TQObject *parent) +:TQObject(parent) { d = new Private; } @@ -881,11 +881,11 @@ void TLS::setCertificate(const Cert &cert, const RSAKey &key) d->ourKey = key; } -void TLS::setCertificateStore(const QPtrList &store) +void TLS::setCertificateStore(const TQPtrList &store) { // convert the cert list into a context list d->store.clear(); - QPtrListIterator it(store); + TQPtrListIterator it(store); for(Cert *cert; (cert = it.current()); ++it) d->store.append(cert->d->c); } @@ -895,14 +895,14 @@ void TLS::reset() d->reset(); } -bool TLS::startClient(const QString &host) +bool TLS::startClient(const TQString &host) { d->reset(); d->host = host; if(!d->c->startClient(d->store, *d->ourCert.d->c, *d->ourKey.d->c)) return false; - QTimer::singleShot(0, this, SLOT(update())); + TQTimer::singleShot(0, this, TQT_SLOT(update())); return true; } @@ -912,7 +912,7 @@ bool TLS::startServer() if(!d->c->startServer(d->store, *d->ourCert.d->c, *d->ourKey.d->c)) return false; - QTimer::singleShot(0, this, SLOT(update())); + TQTimer::singleShot(0, this, TQT_SLOT(update())); return true; } @@ -922,7 +922,7 @@ void TLS::close() return; d->closing = true; - QTimer::singleShot(0, this, SLOT(update())); + TQTimer::singleShot(0, this, TQT_SLOT(update())); } bool TLS::isHandshaken() const @@ -930,35 +930,35 @@ bool TLS::isHandshaken() const return d->handshaken; } -void TLS::write(const QByteArray &a) +void TLS::write(const TQByteArray &a) { d->appendArray(&d->out, a); update(); } -QByteArray TLS::read() +TQByteArray TLS::read() { - QByteArray a = d->in.copy(); + TQByteArray a = d->in.copy(); d->in.resize(0); return a; } -void TLS::writeIncoming(const QByteArray &a) +void TLS::writeIncoming(const TQByteArray &a) { d->appendArray(&d->from_net, a); update(); } -QByteArray TLS::readOutgoing() +TQByteArray TLS::readOutgoing() { - QByteArray a = d->to_net.copy(); + TQByteArray a = d->to_net.copy(); d->to_net.resize(0); return a; } -QByteArray TLS::readUnprocessed() +TQByteArray TLS::readUnprocessed() { - QByteArray a = d->from_net.copy(); + TQByteArray a = d->from_net.copy(); d->from_net.resize(0); return a; } @@ -981,10 +981,10 @@ void TLS::update() bool force_read = false; bool eof = false; bool done = false; - QGuardedPtr self = this; + TQGuardedPtr self = this; if(d->closing) { - QByteArray a; + TQByteArray a; int r = d->c->shutdown(d->from_net, &a); d->from_net.resize(0); if(r == QCA_TLSContext::Error) { @@ -1000,7 +1000,7 @@ void TLS::update() } else { if(!d->handshaken) { - QByteArray a; + TQByteArray a; int r = d->c->handshake(d->from_net, &a); d->from_net.resize(0); if(r == QCA_TLSContext::Error) { @@ -1029,7 +1029,7 @@ void TLS::update() if(d->handshaken) { if(!d->out.isEmpty() || d->tryMore) { d->tryMore = false; - QByteArray a; + TQByteArray a; int enc; bool more = false; bool ok = d->c->encode(d->out, &a, &enc); @@ -1050,7 +1050,7 @@ void TLS::update() } } if(!d->from_net.isEmpty() || force_read) { - QByteArray a, b; + TQByteArray a, b; bool ok = d->c->decode(d->from_net, &a, &b); eof = d->c->eof(); d->from_net.resize(0); @@ -1096,7 +1096,7 @@ void TLS::update() //---------------------------------------------------------------------------- // SASL //---------------------------------------------------------------------------- -QString saslappname = "qca"; +TQString saslappname = "qca"; class SASL::Private { public: @@ -1118,22 +1118,22 @@ public: // security opts bool noPlain, noActive, noDict, noAnon, reqForward, reqCreds, reqMutual; int ssfmin, ssfmax; - QString ext_authid; + TQString ext_authid; int ext_ssf; bool tried; QCA_SASLContext *c; - QHostAddress localAddr, remoteAddr; + TQHostAddress localAddr, remoteAddr; int localPort, remotePort; - QByteArray stepData; + TQByteArray stepData; bool allowCSF; bool first, server; - QByteArray inbuf, outbuf; + TQByteArray inbuf, outbuf; }; -SASL::SASL(QObject *parent) -:QObject(parent) +SASL::SASL(TQObject *parent) +:TQObject(parent) { d = new Private; reset(); @@ -1144,7 +1144,7 @@ SASL::~SASL() delete d; } -void SASL::setAppName(const QString &name) +void SASL::setAppName(const TQString &name) { saslappname = name; } @@ -1222,7 +1222,7 @@ void SASL::setMaximumSSF(int x) d->ssfmax = x; } -void SASL::setExternalAuthID(const QString &authid) +void SASL::setExternalAuthID(const TQString &authid) { d->ext_authid = authid; } @@ -1232,19 +1232,19 @@ void SASL::setExternalSSF(int x) d->ext_ssf = x; } -void SASL::setLocalAddr(const QHostAddress &addr, Q_UINT16 port) +void SASL::setLocalAddr(const TQHostAddress &addr, Q_UINT16 port) { d->localAddr = addr; d->localPort = port; } -void SASL::setRemoteAddr(const QHostAddress &addr, Q_UINT16 port) +void SASL::setRemoteAddr(const TQHostAddress &addr, Q_UINT16 port) { d->remoteAddr = addr; d->remotePort = port; } -bool SASL::startClient(const QString &service, const QString &host, const QStringList &mechlist, bool allowClientSendFirst) +bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst) { QCA_SASLHostPort la, ra; if(d->localPort != -1) { @@ -1265,11 +1265,11 @@ bool SASL::startClient(const QString &service, const QString &host, const QStrin d->first = true; d->server = false; d->tried = false; - QTimer::singleShot(0, this, SLOT(tryAgain())); + TQTimer::singleShot(0, this, TQT_SLOT(tryAgain())); return true; } -bool SASL::startServer(const QString &service, const QString &host, const QString &realm, QStringList *mechlist) +bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist) { QCA_SASLHostPort la, ra; if(d->localPort != -1) { @@ -1292,13 +1292,13 @@ bool SASL::startServer(const QString &service, const QString &host, const QStrin return true; } -void SASL::putServerFirstStep(const QString &mech) +void SASL::putServerFirstStep(const TQString &mech) { int r = d->c->serverFirstStep(mech, 0); handleServerFirstStep(r); } -void SASL::putServerFirstStep(const QString &mech, const QByteArray &clientInit) +void SASL::putServerFirstStep(const TQString &mech, const TQByteArray &clientInit) { int r = d->c->serverFirstStep(mech, &clientInit); handleServerFirstStep(r); @@ -1316,28 +1316,28 @@ void SASL::handleServerFirstStep(int r) error(ErrAuth); } -void SASL::putStep(const QByteArray &stepData) +void SASL::putStep(const TQByteArray &stepData) { d->stepData = stepData.copy(); tryAgain(); } -void SASL::setUsername(const QString &user) +void SASL::setUsername(const TQString &user) { d->c->setClientParams(&user, 0, 0, 0); } -void SASL::setAuthzid(const QString &authzid) +void SASL::setAuthzid(const TQString &authzid) { d->c->setClientParams(0, &authzid, 0, 0); } -void SASL::setPassword(const QString &pass) +void SASL::setPassword(const TQString &pass) { d->c->setClientParams(0, 0, &pass, 0); } -void SASL::setRealm(const QString &realm) +void SASL::setRealm(const TQString &realm) { d->c->setClientParams(0, 0, 0, &realm); } @@ -1399,8 +1399,8 @@ void SASL::tryAgain() return; } - QString mech = d->c->mech(); - const QByteArray *clientInit = d->c->clientInit(); + TQString mech = d->c->mech(); + const TQByteArray *clientInit = d->c->clientInit(); d->first = false; d->tried = false; @@ -1443,9 +1443,9 @@ int SASL::ssf() const return d->c->security(); } -void SASL::write(const QByteArray &a) +void SASL::write(const TQByteArray &a) { - QByteArray b; + TQByteArray b; if(!d->c->encode(a, &b)) { error(ErrCrypt); return; @@ -1456,16 +1456,16 @@ void SASL::write(const QByteArray &a) readyReadOutgoing(a.size()); } -QByteArray SASL::read() +TQByteArray SASL::read() { - QByteArray a = d->inbuf.copy(); + TQByteArray a = d->inbuf.copy(); d->inbuf.resize(0); return a; } -void SASL::writeIncoming(const QByteArray &a) +void SASL::writeIncoming(const TQByteArray &a) { - QByteArray b; + TQByteArray b; if(!d->c->decode(a, &b)) { error(ErrCrypt); return; @@ -1476,9 +1476,9 @@ void SASL::writeIncoming(const QByteArray &a) readyRead(); } -QByteArray SASL::readOutgoing() +TQByteArray SASL::readOutgoing() { - QByteArray a = d->outbuf.copy(); + TQByteArray a = d->outbuf.copy(); d->outbuf.resize(0); return a; } diff --git a/kopete/protocols/groupwise/libgroupwise/qca/src/qca.h b/kopete/protocols/groupwise/libgroupwise/qca/src/qca.h index 1a52a826..46b25cc9 100644 --- a/kopete/protocols/groupwise/libgroupwise/qca/src/qca.h +++ b/kopete/protocols/groupwise/libgroupwise/qca/src/qca.h @@ -21,12 +21,12 @@ #ifndef QCA_H #define QCA_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #ifdef Q_OS_WIN32 # ifndef QCA_STATIC @@ -91,8 +91,8 @@ namespace QCA QCA_EXPORT void insertProvider(QCAProvider *); QCA_EXPORT void unloadAllPlugins(); - QCA_EXPORT QString arrayToHex(const QByteArray &); - QCA_EXPORT QByteArray hexToArray(const QString &); + QCA_EXPORT TQString arrayToHex(const TQByteArray &); + QCA_EXPORT TQByteArray hexToArray(const TQString &); class QCA_EXPORT Hash { @@ -102,8 +102,8 @@ namespace QCA ~Hash(); void clear(); - void update(const QByteArray &a); - QByteArray final(); + void update(const TQByteArray &a); + TQByteArray final(); protected: Hash(QCA_HashContext *); @@ -119,26 +119,26 @@ namespace QCA public: HashStatic() {} - static QByteArray hash(const QByteArray &a) + static TQByteArray hash(const TQByteArray &a) { T obj; obj.update(a); return obj.final(); } - static QByteArray hash(const QCString &cs) + static TQByteArray hash(const TQCString &cs) { - QByteArray a(cs.length()); + TQByteArray a(cs.length()); memcpy(a.data(), cs.data(), a.size()); return hash(a); } - static QString hashToString(const QByteArray &a) + static TQString hashToString(const TQByteArray &a) { return arrayToHex(hash(a)); } - static QString hashToString(const QCString &cs) + static TQString hashToString(const TQCString &cs) { return arrayToHex(hash(cs)); } @@ -151,14 +151,14 @@ namespace QCA Cipher & operator=(const Cipher &); ~Cipher(); - QByteArray dyn_generateKey(int size=-1) const; - QByteArray dyn_generateIV() const; - void reset(int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad=true); - bool update(const QByteArray &a); - QByteArray final(bool *ok=0); + TQByteArray dyn_generateKey(int size=-1) const; + TQByteArray dyn_generateIV() const; + void reset(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad=true); + bool update(const TQByteArray &a); + TQByteArray final(bool *ok=0); protected: - Cipher(QCA_CipherContext *, int dir, int mode, const QByteArray &key, const QByteArray &iv, bool pad); + Cipher(QCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad); private: class Private; @@ -171,13 +171,13 @@ namespace QCA public: CipherStatic() {} - static QByteArray generateKey(int size=-1) + static TQByteArray generateKey(int size=-1) { T obj; return obj.dyn_generateKey(size); } - static QByteArray generateIV() + static TQByteArray generateIV() { T obj; return obj.dyn_generateIV(); @@ -205,25 +205,25 @@ namespace QCA class QCA_EXPORT BlowFish : public Cipher, public CipherStatic { public: - BlowFish(int dir=Encrypt, int mode=CBC, const QByteArray &key=QByteArray(), const QByteArray &iv=QByteArray(), bool pad=true); + BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true); }; class QCA_EXPORT TripleDES : public Cipher, public CipherStatic { public: - TripleDES(int dir=Encrypt, int mode=CBC, const QByteArray &key=QByteArray(), const QByteArray &iv=QByteArray(), bool pad=true); + TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true); }; class QCA_EXPORT AES128 : public Cipher, public CipherStatic { public: - AES128(int dir=Encrypt, int mode=CBC, const QByteArray &key=QByteArray(), const QByteArray &iv=QByteArray(), bool pad=true); + AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true); }; class QCA_EXPORT AES256 : public Cipher, public CipherStatic { public: - AES256(int dir=Encrypt, int mode=CBC, const QByteArray &key=QByteArray(), const QByteArray &iv=QByteArray(), bool pad=true); + AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true); }; class RSA; @@ -239,11 +239,11 @@ namespace QCA bool havePublic() const; bool havePrivate() const; - QByteArray toDER(bool publicOnly=false) const; - bool fromDER(const QByteArray &a); + TQByteArray toDER(bool publicOnly=false) const; + bool fromDER(const TQByteArray &a); - QString toPEM(bool publicOnly=false) const; - bool fromPEM(const QString &); + TQString toPEM(bool publicOnly=false) const; + bool fromPEM(const TQString &); // only call if you know what you are doing bool fromNative(void *); @@ -254,8 +254,8 @@ namespace QCA friend class RSA; friend class TLS; - bool encrypt(const QByteArray &a, QByteArray *out, bool oaep) const; - bool decrypt(const QByteArray &a, QByteArray *out, bool oaep) const; + bool encrypt(const TQByteArray &a, TQByteArray *out, bool oaep) const; + bool decrypt(const TQByteArray &a, TQByteArray *out, bool oaep) const; bool generate(unsigned int bits); }; @@ -268,8 +268,8 @@ namespace QCA RSAKey key() const; void setKey(const RSAKey &); - bool encrypt(const QByteArray &a, QByteArray *out, bool oaep=false) const; - bool decrypt(const QByteArray &a, QByteArray *out, bool oaep=false) const; + bool encrypt(const TQByteArray &a, TQByteArray *out, bool oaep=false) const; + bool decrypt(const TQByteArray &a, TQByteArray *out, bool oaep=false) const; static RSAKey generateKey(unsigned int bits); @@ -277,7 +277,7 @@ namespace QCA RSAKey v_key; }; - typedef QMap CertProperties; + typedef TQMap CertProperties; class QCA_EXPORT Cert { public: @@ -288,20 +288,20 @@ namespace QCA bool isNull() const; - QString commonName() const; - QString serialNumber() const; - QString subjectString() const; - QString issuerString() const; + TQString commonName() const; + TQString serialNumber() const; + TQString subjectString() const; + TQString issuerString() const; CertProperties subject() const; CertProperties issuer() const; - QDateTime notBefore() const; - QDateTime notAfter() const; + TQDateTime notBefore() const; + TQDateTime notAfter() const; - QByteArray toDER() const; - bool fromDER(const QByteArray &a); + TQByteArray toDER() const; + bool fromDER(const TQByteArray &a); - QString toPEM() const; - bool fromPEM(const QString &); + TQString toPEM() const; + bool fromPEM(const TQString &); private: class Private; @@ -332,26 +332,26 @@ namespace QCA }; enum Error { ErrHandshake, ErrCrypt }; - TLS(QObject *parent=0); + TLS(TQObject *parent=0); ~TLS(); void setCertificate(const Cert &cert, const RSAKey &key); - void setCertificateStore(const QPtrList &store); // note: store must persist + void setCertificateStore(const TQPtrList &store); // note: store must persist void reset(); - bool startClient(const QString &host=""); + bool startClient(const TQString &host=""); bool startServer(); void close(); bool isHandshaken() const; // plain (application side) - void write(const QByteArray &a); - QByteArray read(); + void write(const TQByteArray &a); + TQByteArray read(); // encoded (socket side) - void writeIncoming(const QByteArray &a); - QByteArray readOutgoing(); - QByteArray readUnprocessed(); + void writeIncoming(const TQByteArray &a); + TQByteArray readOutgoing(); + TQByteArray readUnprocessed(); // cert related const Cert & peerCertificate() const; @@ -390,10 +390,10 @@ namespace QCA NoUser, RemoteUnavail }; - SASL(QObject *parent=0); + SASL(TQObject *parent=0); ~SASL(); - static void setAppName(const QString &name); + static void setAppName(const TQString &name); void reset(); int errorCondition() const; @@ -409,40 +409,40 @@ namespace QCA void setMinimumSSF(int); void setMaximumSSF(int); - void setExternalAuthID(const QString &authid); + void setExternalAuthID(const TQString &authid); void setExternalSSF(int); - void setLocalAddr(const QHostAddress &addr, Q_UINT16 port); - void setRemoteAddr(const QHostAddress &addr, Q_UINT16 port); + void setLocalAddr(const TQHostAddress &addr, Q_UINT16 port); + void setRemoteAddr(const TQHostAddress &addr, Q_UINT16 port); // initialize - bool startClient(const QString &service, const QString &host, const QStringList &mechlist, bool allowClientSendFirst=true); - bool startServer(const QString &service, const QString &host, const QString &realm, QStringList *mechlist); + bool startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst=true); + bool startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist); // authentication - void putStep(const QByteArray &stepData); - void putServerFirstStep(const QString &mech); - void putServerFirstStep(const QString &mech, const QByteArray &clientInit); - void setUsername(const QString &user); - void setAuthzid(const QString &auth); - void setPassword(const QString &pass); - void setRealm(const QString &realm); + void putStep(const TQByteArray &stepData); + void putServerFirstStep(const TQString &mech); + void putServerFirstStep(const TQString &mech, const TQByteArray &clientInit); + void setUsername(const TQString &user); + void setAuthzid(const TQString &auth); + void setPassword(const TQString &pass); + void setRealm(const TQString &realm); void continueAfterParams(); void continueAfterAuthCheck(); // security layer int ssf() const; - void write(const QByteArray &a); - QByteArray read(); - void writeIncoming(const QByteArray &a); - QByteArray readOutgoing(); + void write(const TQByteArray &a); + TQByteArray read(); + void writeIncoming(const TQByteArray &a); + TQByteArray readOutgoing(); signals: // for authentication - void clientFirstStep(const QString &mech, const QByteArray *clientInit); - void nextStep(const QByteArray &stepData); + void clientFirstStep(const TQString &mech, const TQByteArray *clientInit); + void nextStep(const TQByteArray &stepData); void needParams(bool user, bool authzid, bool pass, bool realm); - void authCheck(const QString &user, const QString &authzid); + void authCheck(const TQString &user, const TQString &authzid); void authenticated(); // for security layer diff --git a/kopete/protocols/groupwise/libgroupwise/qca/src/qcaprovider.h b/kopete/protocols/groupwise/libgroupwise/qca/src/qcaprovider.h index e6172434..6eda17f9 100644 --- a/kopete/protocols/groupwise/libgroupwise/qca/src/qcaprovider.h +++ b/kopete/protocols/groupwise/libgroupwise/qca/src/qcaprovider.h @@ -21,11 +21,11 @@ #ifndef QCAPROVIDER_H #define QCAPROVIDER_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include"qca.h" #define QCA_PLUGIN_VERSION 1 @@ -50,7 +50,7 @@ public: virtual QCA_HashContext *clone()=0; virtual void reset()=0; virtual void update(const char *in, unsigned int len)=0; - virtual void final(QByteArray *out)=0; + virtual void final(TQByteArray *out)=0; }; class QCA_CipherContext @@ -66,7 +66,7 @@ public: virtual bool setup(int dir, int mode, const char *key, int keysize, const char *iv, bool pad)=0; virtual bool update(const char *in, unsigned int len)=0; - virtual bool final(QByteArray *out)=0; + virtual bool final(TQByteArray *out)=0; }; class QCA_RSAKeyContext @@ -82,17 +82,17 @@ public: virtual bool createFromPEM(const char *in, unsigned int len)=0; virtual bool createFromNative(void *in)=0; virtual bool generate(unsigned int bits)=0; - virtual bool toDER(QByteArray *out, bool publicOnly)=0; - virtual bool toPEM(QByteArray *out, bool publicOnly)=0; + virtual bool toDER(TQByteArray *out, bool publicOnly)=0; + virtual bool toPEM(TQByteArray *out, bool publicOnly)=0; - virtual bool encrypt(const QByteArray &in, QByteArray *out, bool oaep)=0; - virtual bool decrypt(const QByteArray &in, QByteArray *out, bool oaep)=0; + virtual bool encrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0; + virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0; }; struct QCA_CertProperty { - QString var; - QString val; + TQString var; + TQString val; }; class QCA_CertContext @@ -104,17 +104,17 @@ public: virtual bool isNull() const=0; virtual bool createFromDER(const char *in, unsigned int len)=0; virtual bool createFromPEM(const char *in, unsigned int len)=0; - virtual bool toDER(QByteArray *out)=0; - virtual bool toPEM(QByteArray *out)=0; - - virtual QString serialNumber() const=0; - virtual QString subjectString() const=0; - virtual QString issuerString() const=0; - virtual QValueList subject() const=0; - virtual QValueList issuer() const=0; - virtual QDateTime notBefore() const=0; - virtual QDateTime notAfter() const=0; - virtual bool matchesAddress(const QString &realHost) const=0; + virtual bool toDER(TQByteArray *out)=0; + virtual bool toPEM(TQByteArray *out)=0; + + virtual TQString serialNumber() const=0; + virtual TQString subjectString() const=0; + virtual TQString issuerString() const=0; + virtual TQValueList subject() const=0; + virtual TQValueList issuer() const=0; + virtual TQDateTime notBefore() const=0; + virtual TQDateTime notAfter() const=0; + virtual bool matchesAddress(const TQString &realHost) const=0; }; class QCA_TLSContext @@ -124,15 +124,15 @@ public: virtual ~QCA_TLSContext() {} virtual void reset()=0; - virtual bool startClient(const QPtrList &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; - virtual bool startServer(const QPtrList &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; + virtual bool startClient(const TQPtrList &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; + virtual bool startServer(const TQPtrList &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; - virtual int handshake(const QByteArray &in, QByteArray *out)=0; - virtual int shutdown(const QByteArray &in, QByteArray *out)=0; - virtual bool encode(const QByteArray &plain, QByteArray *to_net, int *encoded)=0; - virtual bool decode(const QByteArray &from_net, QByteArray *plain, QByteArray *to_net)=0; + virtual int handshake(const TQByteArray &in, TQByteArray *out)=0; + virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0; + virtual bool encode(const TQByteArray &plain, TQByteArray *to_net, int *encoded)=0; + virtual bool decode(const TQByteArray &from_net, TQByteArray *plain, TQByteArray *to_net)=0; virtual bool eof() const=0; - virtual QByteArray unprocessed()=0; + virtual TQByteArray unprocessed()=0; virtual QCA_CertContext *peerCertificate() const=0; virtual int validityResult() const=0; @@ -140,7 +140,7 @@ public: struct QCA_SASLHostPort { - QHostAddress addr; + TQHostAddress addr; Q_UINT16 port; }; @@ -157,35 +157,35 @@ public: // common virtual void reset()=0; - virtual void setCoreProps(const QString &service, const QString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0; - virtual void setSecurityProps(bool noPlain, bool noActive, bool noDict, bool noAnon, bool reqForward, bool reqCreds, bool reqMutual, int ssfMin, int ssfMax, const QString &_ext_authid, int _ext_ssf)=0; + virtual void setCoreProps(const TQString &service, const TQString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0; + virtual void setSecurityProps(bool noPlain, bool noActive, bool noDict, bool noAnon, bool reqForward, bool reqCreds, bool reqMutual, int ssfMin, int ssfMax, const TQString &_ext_authid, int _ext_ssf)=0; virtual int security() const=0; virtual int errorCond() const=0; // init / first step - virtual bool clientStart(const QStringList &mechlist)=0; + virtual bool clientStart(const TQStringList &mechlist)=0; virtual int clientFirstStep(bool allowClientSendFirst)=0; - virtual bool serverStart(const QString &realm, QStringList *mechlist, const QString &name)=0; - virtual int serverFirstStep(const QString &mech, const QByteArray *in)=0; + virtual bool serverStart(const TQString &realm, TQStringList *mechlist, const TQString &name)=0; + virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0; // get / set params virtual QCA_SASLNeedParams clientParamsNeeded() const=0; - virtual void setClientParams(const QString *user, const QString *authzid, const QString *pass, const QString *realm)=0; - virtual QString username() const=0; - virtual QString authzid() const=0; + virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0; + virtual TQString username() const=0; + virtual TQString authzid() const=0; // continue steps - virtual int nextStep(const QByteArray &in)=0; + virtual int nextStep(const TQByteArray &in)=0; virtual int tryAgain()=0; // results - virtual QString mech() const=0; - virtual const QByteArray *clientInit() const=0; - virtual QByteArray result() const=0; + virtual TQString mech() const=0; + virtual const TQByteArray *clientInit() const=0; + virtual TQByteArray result() const=0; // security layer - virtual bool encode(const QByteArray &in, QByteArray *out)=0; - virtual bool decode(const QByteArray &in, QByteArray *out)=0; + virtual bool encode(const TQByteArray &in, TQByteArray *out)=0; + virtual bool decode(const TQByteArray &in, TQByteArray *out)=0; }; #endif -- cgit v1.2.1