Rename QCA to TQCA

Fix FTBFS
pull/1/head
Slávek Banko 12 years ago
parent b701e9bde1
commit 68b5e38626

@ -43,7 +43,7 @@
#include <kopeteview.h> #include <kopeteview.h>
#include "client.h" #include "client.h"
#include "qca.h" #include <qca.h>
#include "gwcontact.h" #include "gwcontact.h"
#include "gwcontactlist.h" #include "gwcontactlist.h"
#include "gwprotocol.h" #include "gwprotocol.h"
@ -87,7 +87,7 @@ GroupWiseAccount::GroupWiseAccount( GroupWiseProtocol *parent, const TQString& a
TQT_SLOT( slotPrivacy() ), this, "actionPrivacy"); TQT_SLOT( slotPrivacy() ), this, "actionPrivacy");
m_connector = 0; m_connector = 0;
m_QCATLS = 0; m_TQCATLS = 0;
m_tlsHandler = 0; m_tlsHandler = 0;
m_clientStream = 0; m_clientStream = 0;
m_client = 0; m_client = 0;
@ -243,12 +243,12 @@ void GroupWiseAccount::performConnectWithPassword( const TQString &password )
if ( isConnected () ) if ( isConnected () )
return; return;
bool sslPossible = QCA::isSupported(QCA::CAP_TLS); bool sslPossible = TQCA::isSupported(TQCA::CAP_TLS);
if (!sslPossible) if (!sslPossible)
{ {
KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error, KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
i18n ("SSL support could not be initialized for account %1. This is most likely because the QCA TLS plugin is not installed on your system."). i18n ("SSL support could not be initialized for account %1. This is most likely because the TQCA TLS plugin is not installed on your system.").
arg(myself()->contactId()), arg(myself()->contactId()),
i18n ("GroupWise SSL Error")); i18n ("GroupWise SSL Error"));
return; return;
@ -263,9 +263,9 @@ void GroupWiseAccount::performConnectWithPassword( const TQString &password )
//myConnector->setOptHostPort( "localhost", 8300 ); //myConnector->setOptHostPort( "localhost", 8300 );
m_connector->setOptHostPort( server(), port() ); m_connector->setOptHostPort( server(), port() );
m_connector->setOptSSL( true ); m_connector->setOptSSL( true );
Q_ASSERT( QCA::isSupported(QCA::CAP_TLS) ); Q_ASSERT( TQCA::isSupported(TQCA::CAP_TLS) );
m_QCATLS = new QCA::TLS; m_TQCATLS = new TQCA::TLS;
m_tlsHandler = new QCATLSHandler( m_QCATLS ); m_tlsHandler = new TQCATLSHandler( m_TQCATLS );
m_clientStream = new ClientStream( m_connector, m_tlsHandler, 0); m_clientStream = new ClientStream( m_connector, m_tlsHandler, 0);
TQObject::connect( m_connector, TQT_SIGNAL( error() ), this, TQT_SLOT( slotConnError() ) ); TQObject::connect( m_connector, TQT_SIGNAL( error() ), this, TQT_SLOT( slotConnError() ) );
@ -439,11 +439,11 @@ void GroupWiseAccount::cleanup()
{ {
delete m_client; delete m_client;
delete m_clientStream; delete m_clientStream;
delete m_QCATLS; delete m_TQCATLS;
delete m_connector; delete m_connector;
m_connector = 0; m_connector = 0;
m_QCATLS = 0; m_TQCATLS = 0;
m_clientStream = 0; m_clientStream = 0;
m_client = 0; m_client = 0;
} }
@ -687,9 +687,9 @@ void GroupWiseAccount::slotCSWarning( int warning )
void GroupWiseAccount::slotTLSHandshaken() void GroupWiseAccount::slotTLSHandshaken()
{ {
kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << "TLS handshake complete" << endl; kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << "TLS handshake complete" << endl;
int validityResult = m_QCATLS->certificateValidityResult (); int validityResult = m_TQCATLS->certificateValidityResult ();
if( validityResult == QCA::TLS::Valid ) if( validityResult == TQCA::TLS::Valid )
{ {
kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << "Certificate is valid, continuing." << endl; kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << "Certificate is valid, continuing." << endl;
// valid certificate, continue // valid certificate, continue
@ -716,53 +716,53 @@ int GroupWiseAccount::handleTLSWarning (int warning, TQString server, TQString a
switch(warning) switch(warning)
{ {
case QCA::TLS::NoCert: case TQCA::TLS::NoCert:
validityString = i18n("No certificate was presented."); validityString = i18n("No certificate was presented.");
code = "NoCert"; code = "NoCert";
break; break;
case QCA::TLS::HostMismatch: case TQCA::TLS::HostMismatch:
validityString = i18n("The host name does not match the one in the certificate."); validityString = i18n("The host name does not match the one in the certificate.");
code = "HostMismatch"; code = "HostMismatch";
break; break;
case QCA::TLS::Rejected: case TQCA::TLS::Rejected:
validityString = i18n("The Certificate Authority rejected the certificate."); validityString = i18n("The Certificate Authority rejected the certificate.");
code = "Rejected"; code = "Rejected";
break; break;
case QCA::TLS::Untrusted: case TQCA::TLS::Untrusted:
// FIXME: write better error message here // FIXME: write better error message here
validityString = i18n("The certificate is untrusted."); validityString = i18n("The certificate is untrusted.");
code = "Untrusted"; code = "Untrusted";
break; break;
case QCA::TLS::SignatureFailed: case TQCA::TLS::SignatureFailed:
validityString = i18n("The signature is invalid."); validityString = i18n("The signature is invalid.");
code = "SignatureFailed"; code = "SignatureFailed";
break; break;
case QCA::TLS::InvalidCA: case TQCA::TLS::InvalidCA:
validityString = i18n("The Certificate Authority is invalid."); validityString = i18n("The Certificate Authority is invalid.");
code = "InvalidCA"; code = "InvalidCA";
break; break;
case QCA::TLS::InvalidPurpose: case TQCA::TLS::InvalidPurpose:
// FIXME: write better error message here // FIXME: write better error message here
validityString = i18n("Invalid certificate purpose."); validityString = i18n("Invalid certificate purpose.");
code = "InvalidPurpose"; code = "InvalidPurpose";
break; break;
case QCA::TLS::SelfSigned: case TQCA::TLS::SelfSigned:
validityString = i18n("The certificate is self-signed."); validityString = i18n("The certificate is self-signed.");
code = "SelfSigned"; code = "SelfSigned";
break; break;
case QCA::TLS::Revoked: case TQCA::TLS::Revoked:
validityString = i18n("The certificate has been revoked."); validityString = i18n("The certificate has been revoked.");
code = "Revoked"; code = "Revoked";
break; break;
case QCA::TLS::PathLengthExceeded: case TQCA::TLS::PathLengthExceeded:
validityString = i18n("Maximum certificate chain length was exceeded."); validityString = i18n("Maximum certificate chain length was exceeded.");
code = "PathLengthExceeded"; code = "PathLengthExceeded";
break; break;
case QCA::TLS::Expired: case TQCA::TLS::Expired:
validityString = i18n("The certificate has expired."); validityString = i18n("The certificate has expired.");
code = "Expired"; code = "Expired";
break; break;
case QCA::TLS::Unknown: case TQCA::TLS::Unknown:
default: default:
validityString = i18n("An unknown error occurred trying to validate the certificate."); validityString = i18n("An unknown error occurred trying to validate the certificate.");
code = "Unknown"; code = "Unknown";

@ -41,10 +41,10 @@ class GroupWiseContact;
class GroupWiseChatSession; class GroupWiseChatSession;
class GroupWiseProtocol; class GroupWiseProtocol;
class KNetworkConnector; class KNetworkConnector;
namespace QCA { namespace TQCA {
class TLS; class TLS;
} }
class QCATLSHandler; class TQCATLSHandler;
class ClientStream; class ClientStream;
class Client; class Client;
class GWContactList; class GWContactList;
@ -328,8 +328,8 @@ private:
KAction * m_actionJoinChatRoom; KAction * m_actionJoinChatRoom;
// Network code // Network code
KNetworkConnector * m_connector; KNetworkConnector * m_connector;
QCA::TLS * m_QCATLS; TQCA::TLS * m_TQCATLS;
QCATLSHandler * m_tlsHandler; TQCATLSHandler * m_tlsHandler;
ClientStream * m_clientStream; ClientStream * m_clientStream;
// Client, entry point of libgroupwise // Client, entry point of libgroupwise
Client * m_client; Client * m_client;

@ -116,8 +116,8 @@ public:
Connector *conn; Connector *conn;
ByteStream *bs; ByteStream *bs;
TLSHandler *tlsHandler; TLSHandler *tlsHandler;
QCA::TLS *tls; TQCA::TLS *tls;
// QCA::SASL *sasl; // TQCA::SASL *sasl;
SecureStream *ss; SecureStream *ss;
CoreProtocol client; CoreProtocol client;
//CoreProtocol srv; //CoreProtocol srv;

@ -1,4 +1,4 @@
Installing QCA Installing TQCA
-------------- --------------
Installation should be straightforward: Installation should be straightforward:

@ -23,7 +23,7 @@ regulation.
And of course, you get a very simple crypto API for Qt, where you can And of course, you get a very simple crypto API for Qt, where you can
do things like: do things like:
QString hash = QCA::SHA1::hashToString(blockOfData); QString hash = TQCA::SHA1::hashToString(blockOfData);
Have fun! Have fun!

@ -40,12 +40,12 @@
#define PLUGIN_EXT "so" #define PLUGIN_EXT "so"
#endif #endif
using namespace QCA; using namespace TQCA;
class ProviderItem class ProviderItem
{ {
public: public:
QCAProvider *p; TQCAProvider *p;
TQString fname; TQString fname;
static ProviderItem *load(const TQString &fname) static ProviderItem *load(const TQString &fname)
@ -60,8 +60,8 @@ public:
delete lib; delete lib;
return 0; return 0;
} }
QCAProvider *(*createProvider)() = (QCAProvider *(*)())s; TQCAProvider *(*createProvider)() = (TQCAProvider *(*)())s;
QCAProvider *p = createProvider(); TQCAProvider *p = createProvider();
if(!p) { if(!p) {
delete lib; delete lib;
return 0; return 0;
@ -71,7 +71,7 @@ public:
return i; return i;
} }
static ProviderItem *fromClass(QCAProvider *p) static ProviderItem *fromClass(TQCAProvider *p)
{ {
ProviderItem *i = new ProviderItem(0, p); ProviderItem *i = new ProviderItem(0, p);
return i; return i;
@ -95,7 +95,7 @@ private:
TQLibrary *lib; TQLibrary *lib;
bool init_done; bool init_done;
ProviderItem(TQLibrary *_lib, QCAProvider *_p) ProviderItem(TQLibrary *_lib, TQCAProvider *_p)
{ {
lib = _lib; lib = _lib;
p = _p; p = _p;
@ -142,7 +142,7 @@ static void plugin_scan()
ProviderItem *i = ProviderItem::load(fname); ProviderItem *i = ProviderItem::load(fname);
if(!i) if(!i)
continue; continue;
if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) { if(i->p->qcaVersion() != TQCA_PLUGIN_VERSION) {
delete i; delete i;
continue; continue;
} }
@ -152,7 +152,7 @@ static void plugin_scan()
} }
} }
static void plugin_addClass(QCAProvider *p) static void plugin_addClass(TQCAProvider *p)
{ {
ProviderItem *i = ProviderItem::fromClass(p); ProviderItem *i = ProviderItem::fromClass(p);
providerList.prepend(i); providerList.prepend(i);
@ -172,7 +172,7 @@ static int plugin_caps()
return caps; return caps;
} }
TQString QCA::arrayToHex(const TQByteArray &a) TQString TQCA::arrayToHex(const TQByteArray &a)
{ {
TQString out; TQString out;
for(int n = 0; n < (int)a.size(); ++n) { for(int n = 0; n < (int)a.size(); ++n) {
@ -183,7 +183,7 @@ TQString QCA::arrayToHex(const TQByteArray &a)
return out; return out;
} }
TQByteArray QCA::hexToArray(const TQString &str) TQByteArray TQCA::hexToArray(const TQString &str)
{ {
TQByteArray out(str.length() / 2); TQByteArray out(str.length() / 2);
int at = 0; int at = 0;
@ -196,7 +196,7 @@ TQByteArray QCA::hexToArray(const TQString &str)
return out; return out;
} }
void QCA::init() void TQCA::init()
{ {
if(qca_init) if(qca_init)
return; return;
@ -204,7 +204,7 @@ void QCA::init()
providerList.setAutoDelete(true); providerList.setAutoDelete(true);
} }
bool QCA::isSupported(int capabilities) bool TQCA::isSupported(int capabilities)
{ {
init(); init();
@ -221,12 +221,12 @@ bool QCA::isSupported(int capabilities)
return false; return false;
} }
void QCA::insertProvider(QCAProvider *p) void TQCA::insertProvider(TQCAProvider *p)
{ {
plugin_addClass(p); plugin_addClass(p);
} }
void QCA::unloadAllPlugins() void TQCA::unloadAllPlugins()
{ {
plugin_unloadall(); plugin_unloadall();
} }
@ -236,7 +236,7 @@ static void *getContext(int cap)
init(); init();
// this call will also trip a scan for new plugins if needed // this call will also trip a scan for new plugins if needed
if(!QCA::isSupported(cap)) if(!TQCA::isSupported(cap))
return 0; return 0;
TQPtrListIterator<ProviderItem> it(providerList); TQPtrListIterator<ProviderItem> it(providerList);
@ -271,10 +271,10 @@ public:
c->reset(); c->reset();
} }
QCA_HashContext *c; TQCA_HashContext *c;
}; };
Hash::Hash(QCA_HashContext *c) Hash::Hash(TQCA_HashContext *c)
{ {
d = new Private; d = new Private;
d->c = c; d->c = c;
@ -340,14 +340,14 @@ public:
err = false; err = false;
} }
QCA_CipherContext *c; TQCA_CipherContext *c;
int dir; int dir;
int mode; int mode;
TQByteArray key, iv; TQByteArray key, iv;
bool err; bool err;
}; };
Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) Cipher::Cipher(TQCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
{ {
d = new Private; d = new Private;
d->c = c; d->c = c;
@ -447,7 +447,7 @@ TQByteArray Cipher::final(bool *ok)
// SHA1 // SHA1
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SHA1::SHA1() SHA1::SHA1()
:Hash((QCA_HashContext *)getContext(CAP_SHA1)) :Hash((TQCA_HashContext *)getContext(CAP_SHA1))
{ {
} }
@ -456,7 +456,7 @@ SHA1::SHA1()
// SHA256 // SHA256
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SHA256::SHA256() SHA256::SHA256()
:Hash((QCA_HashContext *)getContext(CAP_SHA256)) :Hash((TQCA_HashContext *)getContext(CAP_SHA256))
{ {
} }
@ -465,7 +465,7 @@ SHA256::SHA256()
// MD5 // MD5
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
MD5::MD5() MD5::MD5()
:Hash((QCA_HashContext *)getContext(CAP_MD5)) :Hash((TQCA_HashContext *)getContext(CAP_MD5))
{ {
} }
@ -474,7 +474,7 @@ MD5::MD5()
// BlowFish // BlowFish
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
{ {
} }
@ -483,7 +483,7 @@ BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray
// TripleDES // TripleDES
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
{ {
} }
@ -492,7 +492,7 @@ TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArra
// AES128 // AES128
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
{ {
} }
@ -501,7 +501,7 @@ AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv,
// AES256 // AES256
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
{ {
} }
@ -522,13 +522,13 @@ public:
delete c; delete c;
} }
QCA_RSAKeyContext *c; TQCA_RSAKeyContext *c;
}; };
RSAKey::RSAKey() RSAKey::RSAKey()
{ {
d = new Private; d = new Private;
d->c = (QCA_RSAKeyContext *)getContext(CAP_RSA); d->c = (TQCA_RSAKeyContext *)getContext(CAP_RSA);
} }
RSAKey::RSAKey(const RSAKey &from) RSAKey::RSAKey(const RSAKey &from)
@ -685,14 +685,14 @@ public:
delete c; delete c;
} }
QCA_CertContext *c; TQCA_CertContext *c;
}; };
Cert::Cert() Cert::Cert()
{ {
d = new Private; d = new Private;
// crash because this is returning 0 // crash because this is returning 0
d->c = (QCA_CertContext *)getContext(CAP_X509); d->c = (TQCA_CertContext *)getContext(CAP_X509);
} }
Cert::Cert(const Cert &from) Cert::Cert(const Cert &from)
@ -716,7 +716,7 @@ Cert::~Cert()
delete d; delete d;
} }
void Cert::fromContext(QCA_CertContext *ctx) void Cert::fromContext(TQCA_CertContext *ctx)
{ {
delete d->c; delete d->c;
d->c = ctx; d->c = ctx;
@ -750,18 +750,18 @@ TQString Cert::issuerString() const
CertProperties Cert::subject() const CertProperties Cert::subject() const
{ {
TQValueList<QCA_CertProperty> list = d->c->subject(); TQValueList<TQCA_CertProperty> list = d->c->subject();
CertProperties props; CertProperties props;
for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it) for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
props[(*it).var] = (*it).val; props[(*it).var] = (*it).val;
return props; return props;
} }
CertProperties Cert::issuer() const CertProperties Cert::issuer() const
{ {
TQValueList<QCA_CertProperty> list = d->c->issuer(); TQValueList<TQCA_CertProperty> list = d->c->issuer();
CertProperties props; CertProperties props;
for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it) for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
props[(*it).var] = (*it).val; props[(*it).var] = (*it).val;
return props; return props;
} }
@ -818,7 +818,7 @@ class TLS::Private
public: public:
Private() Private()
{ {
c = (QCA_TLSContext *)getContext(CAP_TLS); c = (TQCA_TLSContext *)getContext(CAP_TLS);
} }
~Private() ~Private()
@ -850,7 +850,7 @@ public:
} }
Cert cert; Cert cert;
QCA_TLSContext *c; TQCA_TLSContext *c;
TQByteArray in, out, to_net, from_net; TQByteArray in, out, to_net, from_net;
int bytesEncoded; int bytesEncoded;
bool tryMore; bool tryMore;
@ -861,7 +861,7 @@ public:
Cert ourCert; Cert ourCert;
RSAKey ourKey; RSAKey ourKey;
TQPtrList<QCA_CertContext> store; TQPtrList<TQCA_CertContext> store;
}; };
TLS::TLS(TQObject *parent) TLS::TLS(TQObject *parent)
@ -971,7 +971,7 @@ const Cert & TLS::peerCertificate() const
int TLS::certificateValidityResult() const int TLS::certificateValidityResult() const
{ {
if(d->hostMismatch) if(d->hostMismatch)
return QCA::TLS::HostMismatch; return TQCA::TLS::HostMismatch;
else else
return d->c->validityResult(); return d->c->validityResult();
} }
@ -987,12 +987,12 @@ void TLS::update()
TQByteArray a; TQByteArray a;
int r = d->c->shutdown(d->from_net, &a); int r = d->c->shutdown(d->from_net, &a);
d->from_net.resize(0); d->from_net.resize(0);
if(r == QCA_TLSContext::Error) { if(r == TQCA_TLSContext::Error) {
reset(); reset();
error(ErrHandshake); error(ErrHandshake);
return; return;
} }
if(r == QCA_TLSContext::Success) { if(r == TQCA_TLSContext::Success) {
d->from_net = d->c->unprocessed().copy(); d->from_net = d->c->unprocessed().copy();
done = true; done = true;
} }
@ -1003,15 +1003,15 @@ void TLS::update()
TQByteArray a; TQByteArray a;
int r = d->c->handshake(d->from_net, &a); int r = d->c->handshake(d->from_net, &a);
d->from_net.resize(0); d->from_net.resize(0);
if(r == QCA_TLSContext::Error) { if(r == TQCA_TLSContext::Error) {
reset(); reset();
error(ErrHandshake); error(ErrHandshake);
return; return;
} }
d->appendArray(&d->to_net, a); d->appendArray(&d->to_net, a);
if(r == QCA_TLSContext::Success) { if(r == TQCA_TLSContext::Success) {
QCA_CertContext *cc = d->c->peerCertificate(); TQCA_CertContext *cc = d->c->peerCertificate();
if(cc && !d->host.isEmpty() && d->c->validityResult() == QCA::TLS::Valid) { if(cc && !d->host.isEmpty() && d->c->validityResult() == TQCA::TLS::Valid) {
if(!cc->matchesAddress(d->host)) if(!cc->matchesAddress(d->host))
d->hostMismatch = true; d->hostMismatch = true;
} }
@ -1102,7 +1102,7 @@ class SASL::Private
public: public:
Private() Private()
{ {
c = (QCA_SASLContext *)getContext(CAP_SASL); c = (TQCA_SASLContext *)getContext(CAP_SASL);
} }
~Private() ~Private()
@ -1122,7 +1122,7 @@ public:
int ext_ssf; int ext_ssf;
bool tried; bool tried;
QCA_SASLContext *c; TQCA_SASLContext *c;
TQHostAddress localAddr, remoteAddr; TQHostAddress localAddr, remoteAddr;
int localPort, remotePort; int localPort, remotePort;
TQByteArray stepData; TQByteArray stepData;
@ -1246,7 +1246,7 @@ void SASL::setRemoteAddr(const TQHostAddress &addr, TQ_UINT16 port)
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst) bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
{ {
QCA_SASLHostPort la, ra; TQCA_SASLHostPort la, ra;
if(d->localPort != -1) { if(d->localPort != -1) {
la.addr = d->localAddr; la.addr = d->localAddr;
la.port = d->localPort; la.port = d->localPort;
@ -1271,7 +1271,7 @@ bool SASL::startClient(const TQString &service, const TQString &host, const TQSt
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist) bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
{ {
QCA_SASLHostPort la, ra; TQCA_SASLHostPort la, ra;
if(d->localPort != -1) { if(d->localPort != -1) {
la.addr = d->localAddr; la.addr = d->localAddr;
la.port = d->localPort; la.port = d->localPort;
@ -1306,11 +1306,11 @@ void SASL::putServerFirstStep(const TQString &mech, const TQByteArray &clientIni
void SASL::handleServerFirstStep(int r) void SASL::handleServerFirstStep(int r)
{ {
if(r == QCA_SASLContext::Success) if(r == TQCA_SASLContext::Success)
authenticated(); authenticated();
else if(r == QCA_SASLContext::Continue) else if(r == TQCA_SASLContext::Continue)
nextStep(d->c->result()); nextStep(d->c->result());
else if(r == QCA_SASLContext::AuthCheck) else if(r == TQCA_SASLContext::AuthCheck)
tryAgain(); tryAgain();
else else
error(ErrAuth); error(ErrAuth);
@ -1365,16 +1365,16 @@ void SASL::tryAgain()
r = d->c->tryAgain(); r = d->c->tryAgain();
} }
if(r == QCA_SASLContext::Error) { if(r == TQCA_SASLContext::Error) {
error(ErrAuth); error(ErrAuth);
return; return;
} }
else if(r == QCA_SASLContext::Continue) { else if(r == TQCA_SASLContext::Continue) {
d->tried = false; d->tried = false;
nextStep(d->c->result()); nextStep(d->c->result());
return; return;
} }
else if(r == QCA_SASLContext::AuthCheck) { else if(r == TQCA_SASLContext::AuthCheck) {
authCheck(d->c->username(), d->c->authzid()); authCheck(d->c->username(), d->c->authzid());
return; return;
} }
@ -1388,13 +1388,13 @@ void SASL::tryAgain()
else else
r = d->c->tryAgain(); r = d->c->tryAgain();
if(r == QCA_SASLContext::Error) { if(r == TQCA_SASLContext::Error) {
error(ErrAuth); error(ErrAuth);
return; return;
} }
else if(r == QCA_SASLContext::NeedParams) { else if(r == TQCA_SASLContext::NeedParams) {
//d->tried = false; //d->tried = false;
QCA_SASLNeedParams np = d->c->clientParamsNeeded(); TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
needParams(np.user, np.authzid, np.pass, np.realm); needParams(np.user, np.authzid, np.pass, np.realm);
return; return;
} }
@ -1414,27 +1414,27 @@ void SASL::tryAgain()
else else
r = d->c->tryAgain(); r = d->c->tryAgain();
if(r == QCA_SASLContext::Error) { if(r == TQCA_SASLContext::Error) {
error(ErrAuth); error(ErrAuth);
return; return;
} }
else if(r == QCA_SASLContext::NeedParams) { else if(r == TQCA_SASLContext::NeedParams) {
//d->tried = false; //d->tried = false;
QCA_SASLNeedParams np = d->c->clientParamsNeeded(); TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
needParams(np.user, np.authzid, np.pass, np.realm); needParams(np.user, np.authzid, np.pass, np.realm);
return; return;
} }
d->tried = false; d->tried = false;
//else if(r == QCA_SASLContext::Continue) { //else if(r == TQCA_SASLContext::Continue) {
nextStep(d->c->result()); nextStep(d->c->result());
// return; // return;
//} //}
} }
} }
if(r == QCA_SASLContext::Success) if(r == TQCA_SASLContext::Success)
authenticated(); authenticated();
else if(r == QCA_SASLContext::Error) else if(r == TQCA_SASLContext::Error)
error(ErrAuth); error(ErrAuth);
} }

@ -18,8 +18,8 @@
* *
*/ */
#ifndef QCA_H #ifndef TQCA_H
#define QCA_H #define TQCA_H
#include<tqstring.h> #include<tqstring.h>
#include<tqcstring.h> #include<tqcstring.h>
@ -29,38 +29,38 @@
#include<tqobject.h> #include<tqobject.h>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
# ifndef QCA_STATIC # ifndef TQCA_STATIC
# ifdef QCA_MAKEDLL # ifdef TQCA_MAKEDLL
# define QCA_EXPORT __declspec(dllexport) # define TQCA_EXPORT __declspec(dllexport)
# else # else
# define QCA_EXPORT __declspec(dllimport) # define TQCA_EXPORT __declspec(dllimport)
# endif # endif
# endif # endif
#endif #endif
#ifndef QCA_EXPORT #ifndef TQCA_EXPORT
#define QCA_EXPORT #define TQCA_EXPORT
#endif #endif
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
# ifdef QCA_PLUGIN_DLL # ifdef TQCA_PLUGIN_DLL
# define QCA_PLUGIN_EXPORT extern "C" __declspec(dllexport) # define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllexport)
# else # else
# define QCA_PLUGIN_EXPORT extern "C" __declspec(dllimport) # define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllimport)
# endif # endif
#endif #endif
#ifndef QCA_PLUGIN_EXPORT #ifndef TQCA_PLUGIN_EXPORT
#define QCA_PLUGIN_EXPORT extern "C" #define TQCA_PLUGIN_EXPORT extern "C"
#endif #endif
class TQHostAddress; class TQHostAddress;
class TQStringList; class TQStringList;
class QCAProvider; class TQCAProvider;
class QCA_HashContext; class TQCA_HashContext;
class QCA_CipherContext; class TQCA_CipherContext;
class QCA_CertContext; class TQCA_CertContext;
namespace QCA namespace TQCA
{ {
enum { enum {
CAP_SHA1 = 0x0001, CAP_SHA1 = 0x0001,
@ -86,15 +86,15 @@ namespace QCA
Decrypt = 0x0002 Decrypt = 0x0002
}; };
QCA_EXPORT void init(); TQCA_EXPORT void init();
QCA_EXPORT bool isSupported(int capabilities); TQCA_EXPORT bool isSupported(int capabilities);
QCA_EXPORT void insertProvider(QCAProvider *); TQCA_EXPORT void insertProvider(TQCAProvider *);
QCA_EXPORT void unloadAllPlugins(); TQCA_EXPORT void unloadAllPlugins();
QCA_EXPORT TQString arrayToHex(const TQByteArray &); TQCA_EXPORT TQString arrayToHex(const TQByteArray &);
QCA_EXPORT TQByteArray hexToArray(const TQString &); TQCA_EXPORT TQByteArray hexToArray(const TQString &);
class QCA_EXPORT Hash class TQCA_EXPORT Hash
{ {
public: public:
Hash(const Hash &); Hash(const Hash &);
@ -106,7 +106,7 @@ namespace QCA
TQByteArray final(); TQByteArray final();
protected: protected:
Hash(QCA_HashContext *); Hash(TQCA_HashContext *);
private: private:
class Private; class Private;
@ -114,7 +114,7 @@ namespace QCA
}; };
template <class T> template <class T>
class QCA_EXPORT HashStatic class TQCA_EXPORT HashStatic
{ {
public: public:
HashStatic<T>() {} HashStatic<T>() {}
@ -144,7 +144,7 @@ namespace QCA
} }
}; };
class QCA_EXPORT Cipher class TQCA_EXPORT Cipher
{ {
public: public:
Cipher(const Cipher &); Cipher(const Cipher &);
@ -158,7 +158,7 @@ namespace QCA
TQByteArray final(bool *ok=0); TQByteArray final(bool *ok=0);
protected: protected:
Cipher(QCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad); Cipher(TQCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad);
private: private:
class Private; class Private;
@ -166,7 +166,7 @@ namespace QCA
}; };
template <class T> template <class T>
class QCA_EXPORT CipherStatic class TQCA_EXPORT CipherStatic
{ {
public: public:
CipherStatic<T>() {} CipherStatic<T>() {}
@ -184,50 +184,50 @@ namespace QCA
} }
}; };
class QCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1> class TQCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1>
{ {
public: public:
SHA1(); SHA1();
}; };
class QCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256> class TQCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256>
{ {
public: public:
SHA256(); SHA256();
}; };
class QCA_EXPORT MD5 : public Hash, public HashStatic<MD5> class TQCA_EXPORT MD5 : public Hash, public HashStatic<MD5>
{ {
public: public:
MD5(); MD5();
}; };
class QCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish> class TQCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish>
{ {
public: public:
BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), 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<TripleDES> class TQCA_EXPORT TripleDES : public Cipher, public CipherStatic<TripleDES>
{ {
public: public:
TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), 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<AES128> class TQCA_EXPORT AES128 : public Cipher, public CipherStatic<AES128>
{ {
public: public:
AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), 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<AES256> class TQCA_EXPORT AES256 : public Cipher, public CipherStatic<AES256>
{ {
public: public:
AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true); AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
}; };
class RSA; class RSA;
class QCA_EXPORT RSAKey class TQCA_EXPORT RSAKey
{ {
public: public:
RSAKey(); RSAKey();
@ -259,7 +259,7 @@ namespace QCA
bool generate(unsigned int bits); bool generate(unsigned int bits);
}; };
class QCA_EXPORT RSA class TQCA_EXPORT RSA
{ {
public: public:
RSA(); RSA();
@ -278,7 +278,7 @@ namespace QCA
}; };
typedef TQMap<TQString, TQString> CertProperties; typedef TQMap<TQString, TQString> CertProperties;
class QCA_EXPORT Cert class TQCA_EXPORT Cert
{ {
public: public:
Cert(); Cert();
@ -308,10 +308,10 @@ namespace QCA
Private *d; Private *d;
friend class TLS; friend class TLS;
void fromContext(QCA_CertContext *); void fromContext(TQCA_CertContext *);
}; };
class QCA_EXPORT TLS : public TQObject class TQCA_EXPORT TLS : public TQObject
{ {
Q_OBJECT Q_OBJECT
@ -373,7 +373,7 @@ namespace QCA
Private *d; Private *d;
}; };
class QCA_EXPORT SASL : public TQObject class TQCA_EXPORT SASL : public TQObject
{ {
Q_OBJECT Q_OBJECT

@ -1,5 +1,5 @@
/* /*
* qcaprovider.h - QCA Plugin API * qcaprovider.h - TQCA Plugin API
* Copyright (C) 2003 Justin Karneges * Copyright (C) 2003 Justin Karneges
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -18,8 +18,8 @@
* *
*/ */
#ifndef QCAPROVIDER_H #ifndef TQCAPROVIDER_H
#define QCAPROVIDER_H #define TQCAPROVIDER_H
#include<tqglobal.h> #include<tqglobal.h>
#include<tqstring.h> #include<tqstring.h>
@ -28,13 +28,13 @@
#include<tqhostaddress.h> #include<tqhostaddress.h>
#include"qca.h" #include"qca.h"
#define QCA_PLUGIN_VERSION 1 #define TQCA_PLUGIN_VERSION 1
class QCAProvider class TQCAProvider
{ {
public: public:
QCAProvider() {} TQCAProvider() {}
virtual ~QCAProvider() {} virtual ~TQCAProvider() {}
virtual void init()=0; virtual void init()=0;
virtual int qcaVersion() const=0; virtual int qcaVersion() const=0;
@ -42,23 +42,23 @@ public:
virtual void *context(int cap)=0; virtual void *context(int cap)=0;
}; };
class QCA_HashContext class TQCA_HashContext
{ {
public: public:
virtual ~QCA_HashContext() {} virtual ~TQCA_HashContext() {}
virtual QCA_HashContext *clone()=0; virtual TQCA_HashContext *clone()=0;
virtual void reset()=0; virtual void reset()=0;
virtual void update(const char *in, unsigned int len)=0; virtual void update(const char *in, unsigned int len)=0;
virtual void final(TQByteArray *out)=0; virtual void final(TQByteArray *out)=0;
}; };
class QCA_CipherContext class TQCA_CipherContext
{ {
public: public:
virtual ~QCA_CipherContext() {} virtual ~TQCA_CipherContext() {}
virtual QCA_CipherContext *clone()=0; virtual TQCA_CipherContext *clone()=0;
virtual int keySize()=0; virtual int keySize()=0;
virtual int blockSize()=0; virtual int blockSize()=0;
virtual bool generateKey(char *out, int keysize=-1)=0; virtual bool generateKey(char *out, int keysize=-1)=0;
@ -69,12 +69,12 @@ public:
virtual bool final(TQByteArray *out)=0; virtual bool final(TQByteArray *out)=0;
}; };
class QCA_RSAKeyContext class TQCA_RSAKeyContext
{ {
public: public:
virtual ~QCA_RSAKeyContext() {} virtual ~TQCA_RSAKeyContext() {}
virtual QCA_RSAKeyContext *clone() const=0; virtual TQCA_RSAKeyContext *clone() const=0;
virtual bool isNull() const=0; virtual bool isNull() const=0;
virtual bool havePublic() const=0; virtual bool havePublic() const=0;
virtual bool havePrivate() const=0; virtual bool havePrivate() const=0;
@ -89,18 +89,18 @@ public:
virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0; virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
}; };
struct QCA_CertProperty struct TQCA_CertProperty
{ {
TQString var; TQString var;
TQString val; TQString val;
}; };
class QCA_CertContext class TQCA_CertContext
{ {
public: public:
virtual ~QCA_CertContext() {} virtual ~TQCA_CertContext() {}
virtual QCA_CertContext *clone() const=0; virtual TQCA_CertContext *clone() const=0;
virtual bool isNull() const=0; virtual bool isNull() const=0;
virtual bool createFromDER(const char *in, unsigned int len)=0; virtual bool createFromDER(const char *in, unsigned int len)=0;
virtual bool createFromPEM(const char *in, unsigned int len)=0; virtual bool createFromPEM(const char *in, unsigned int len)=0;
@ -110,22 +110,22 @@ public:
virtual TQString serialNumber() const=0; virtual TQString serialNumber() const=0;
virtual TQString subjectString() const=0; virtual TQString subjectString() const=0;
virtual TQString issuerString() const=0; virtual TQString issuerString() const=0;
virtual TQValueList<QCA_CertProperty> subject() const=0; virtual TQValueList<TQCA_CertProperty> subject() const=0;
virtual TQValueList<QCA_CertProperty> issuer() const=0; virtual TQValueList<TQCA_CertProperty> issuer() const=0;
virtual TQDateTime notBefore() const=0; virtual TQDateTime notBefore() const=0;
virtual TQDateTime notAfter() const=0; virtual TQDateTime notAfter() const=0;
virtual bool matchesAddress(const TQString &realHost) const=0; virtual bool matchesAddress(const TQString &realHost) const=0;
}; };
class QCA_TLSContext class TQCA_TLSContext
{ {
public: public:
enum Result { Success, Error, Continue }; enum Result { Success, Error, Continue };
virtual ~QCA_TLSContext() {} virtual ~TQCA_TLSContext() {}
virtual void reset()=0; virtual void reset()=0;
virtual bool startClient(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; virtual bool startClient(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
virtual bool startServer(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; virtual bool startServer(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
virtual int handshake(const TQByteArray &in, TQByteArray *out)=0; virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0; virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
@ -134,30 +134,30 @@ public:
virtual bool eof() const=0; virtual bool eof() const=0;
virtual TQByteArray unprocessed()=0; virtual TQByteArray unprocessed()=0;
virtual QCA_CertContext *peerCertificate() const=0; virtual TQCA_CertContext *peerCertificate() const=0;
virtual int validityResult() const=0; virtual int validityResult() const=0;
}; };
struct QCA_SASLHostPort struct TQCA_SASLHostPort
{ {
TQHostAddress addr; TQHostAddress addr;
TQ_UINT16 port; TQ_UINT16 port;
}; };
struct QCA_SASLNeedParams struct TQCA_SASLNeedParams
{ {
bool user, authzid, pass, realm; bool user, authzid, pass, realm;
}; };
class QCA_SASLContext class TQCA_SASLContext
{ {
public: public:
enum Result { Success, Error, NeedParams, AuthCheck, Continue }; enum Result { Success, Error, NeedParams, AuthCheck, Continue };
virtual ~QCA_SASLContext() {} virtual ~TQCA_SASLContext() {}
// common // common
virtual void reset()=0; virtual void reset()=0;
virtual void setCoreProps(const TQString &service, const TQString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0; virtual void setCoreProps(const TQString &service, const TQString &host, TQCA_SASLHostPort *local, TQCA_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 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 security() const=0;
virtual int errorCond() const=0; virtual int errorCond() const=0;
@ -169,7 +169,7 @@ public:
virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0; virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
// get / set params // get / set params
virtual QCA_SASLNeedParams clientParamsNeeded() const=0; virtual TQCA_SASLNeedParams clientParamsNeeded() const=0;
virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0; virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
virtual TQString username() const=0; virtual TQString username() const=0;
virtual TQString authzid() const=0; virtual TQString authzid() const=0;

@ -19,18 +19,18 @@
#include <tqtimer.h> #include <tqtimer.h>
#include "qca.h" #include <qca.h>
#include "qcatlshandler.h" #include "qcatlshandler.h"
class QCATLSHandler::Private class TQCATLSHandler::Private
{ {
public: public:
QCA::TLS *tls; TQCA::TLS *tls;
int state, err; int state, err;
}; };
QCATLSHandler::QCATLSHandler(QCA::TLS *parent) TQCATLSHandler::TQCATLSHandler(TQCA::TLS *parent)
:TLSHandler(parent) :TLSHandler(parent)
{ {
d = new Private; d = new Private;
@ -44,28 +44,28 @@ QCATLSHandler::QCATLSHandler(QCA::TLS *parent)
d->err = -1; d->err = -1;
} }
QCATLSHandler::~QCATLSHandler() TQCATLSHandler::~TQCATLSHandler()
{ {
delete d; delete d;
} }
QCA::TLS *QCATLSHandler::tls() const TQCA::TLS *TQCATLSHandler::tls() const
{ {
return d->tls; return d->tls;
} }
int QCATLSHandler::tlsError() const int TQCATLSHandler::tlsError() const
{ {
return d->err; return d->err;
} }
void QCATLSHandler::reset() void TQCATLSHandler::reset()
{ {
d->tls->reset(); d->tls->reset();
d->state = 0; d->state = 0;
} }
void QCATLSHandler::startClient(const TQString &host) void TQCATLSHandler::startClient(const TQString &host)
{ {
d->state = 0; d->state = 0;
d->err = -1; d->err = -1;
@ -73,17 +73,17 @@ void QCATLSHandler::startClient(const TQString &host)
TQTimer::singleShot(0, this, TQT_SIGNAL(fail())); TQTimer::singleShot(0, this, TQT_SIGNAL(fail()));
} }
void QCATLSHandler::write(const TQByteArray &a) void TQCATLSHandler::write(const TQByteArray &a)
{ {
d->tls->write(a); d->tls->write(a);
} }
void QCATLSHandler::writeIncoming(const TQByteArray &a) void TQCATLSHandler::writeIncoming(const TQByteArray &a)
{ {
d->tls->writeIncoming(a); d->tls->writeIncoming(a);
} }
void QCATLSHandler::continueAfterHandshake() void TQCATLSHandler::continueAfterHandshake()
{ {
if(d->state == 2) { if(d->state == 2) {
success(); success();
@ -91,28 +91,28 @@ void QCATLSHandler::continueAfterHandshake()
} }
} }
void QCATLSHandler::tls_handshaken() void TQCATLSHandler::tls_handshaken()
{ {
d->state = 2; d->state = 2;
tlsHandshaken(); tlsHandshaken();
} }
void QCATLSHandler::tls_readyRead() void TQCATLSHandler::tls_readyRead()
{ {
readyRead(d->tls->read()); readyRead(d->tls->read());
} }
void QCATLSHandler::tls_readyReadOutgoing(int plainBytes) void TQCATLSHandler::tls_readyReadOutgoing(int plainBytes)
{ {
readyReadOutgoing(d->tls->readOutgoing(), plainBytes); readyReadOutgoing(d->tls->readOutgoing(), plainBytes);
} }
void QCATLSHandler::tls_closed() void TQCATLSHandler::tls_closed()
{ {
closed(); closed();
} }
void QCATLSHandler::tls_error(int x) void TQCATLSHandler::tls_error(int x)
{ {
d->err = x; d->err = x;
d->state = 0; d->state = 0;

@ -17,23 +17,23 @@
************************************************************************* *************************************************************************
*/ */
#ifndef GWQCATLSHANDLER_H #ifndef GWTQCATLSHANDLER_H
#define GWQCATLSHANDLER_H #define GWTQCATLSHANDLER_H
//#include <tqtimer.h> //#include <tqtimer.h>
#include "tlshandler.h" #include "tlshandler.h"
class QCA::TLS; class TQCA::TLS;
class QCATLSHandler : public TLSHandler class TQCATLSHandler : public TLSHandler
{ {
Q_OBJECT Q_OBJECT
public: public:
QCATLSHandler(QCA::TLS *parent); TQCATLSHandler(TQCA::TLS *parent);
~QCATLSHandler(); ~TQCATLSHandler();
QCA::TLS *tls() const; TQCA::TLS *tls() const;
int tlsError() const; int tlsError() const;
void reset(); void reset();

@ -22,7 +22,7 @@
Note: SecureStream depends on the underlying security layers to signal Note: SecureStream depends on the underlying security layers to signal
plain-to-encrypted results immediately (as opposed to waiting for the plain-to-encrypted results immediately (as opposed to waiting for the
event loop) so that the user cannot add/remove security layers during event loop) so that the user cannot add/remove security layers during
this conversion moment. QCA::TLS and QCA::SASL behave as expected, this conversion moment. TQCA::TLS and TQCA::SASL behave as expected,
but future layers might not. but future layers might not.
*/ */
@ -86,7 +86,7 @@ int LayerTracker::finished(int encoded)
// SecureStream // SecureStream
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SecureLayer::SecureLayer(QCA::TLS *t) SecureLayer::SecureLayer(TQCA::TLS *t)
{ {
type = TLS; type = TLS;
p.tls = t; p.tls = t;
@ -98,7 +98,7 @@ SecureLayer::SecureLayer(QCA::TLS *t)
connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int))); connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
} }
SecureLayer::SecureLayer(QCA::SASL *s) SecureLayer::SecureLayer(TQCA::SASL *s)
{ {
type = SASL; type = SASL;
p.sasl = s; p.sasl = s;
@ -329,7 +329,7 @@ int SecureStream::calcPrebytes() const
return (d->pending - x); return (d->pending - x);
} }
void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &spare) void SecureStream::startTLSClient(TQCA::TLS *t, const TQByteArray &spare)
{ {
if(!d->active || d->topInProgress || d->haveTLS()) if(!d->active || d->topInProgress || d->haveTLS())
return; return;
@ -343,7 +343,7 @@ void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &spare)
insertData(spare); insertData(spare);
} }
void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &spare) void SecureStream::startTLSServer(TQCA::TLS *t, const TQByteArray &spare)
{ {
if(!d->active || d->topInProgress || d->haveTLS()) if(!d->active || d->topInProgress || d->haveTLS())
return; return;
@ -357,7 +357,7 @@ void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &spare)
insertData(spare); insertData(spare);
} }
void SecureStream::setLayerSASL(QCA::SASL *sasl, const TQByteArray &spare) void SecureStream::setLayerSASL(TQCA::SASL *sasl, const TQByteArray &spare)
{ {
if(!d->active || d->topInProgress || d->haveSASL()) if(!d->active || d->topInProgress || d->haveSASL())
return; return;
@ -382,7 +382,7 @@ void SecureStream::startTLSClient(TLSHandler *t, const TQString &server, const T
d->layers.append(s); d->layers.append(s);
d->topInProgress = true; d->topInProgress = true;
// unlike QCA::TLS, TLSHandler has no return value // unlike TQCA::TLS, TLSHandler has no return value
s->p.tlsHandler->startClient(server); s->p.tlsHandler->startClient(server);
insertData(spare); insertData(spare);

@ -40,9 +40,9 @@ public:
SecureStream(ByteStream *s); SecureStream(ByteStream *s);
~SecureStream(); ~SecureStream();
void startTLSClient(QCA::TLS *t, const TQByteArray &spare=TQByteArray()); void startTLSClient(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
void startTLSServer(QCA::TLS *t, const TQByteArray &spare=TQByteArray()); void startTLSServer(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
void setLayerSASL(QCA::SASL *s, const TQByteArray &spare=TQByteArray()); void setLayerSASL(TQCA::SASL *s, const TQByteArray &spare=TQByteArray());
#ifdef USE_TLSHANDLER #ifdef USE_TLSHANDLER
void startTLSClient(TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray()); void startTLSClient(TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray());
#endif #endif
@ -106,8 +106,8 @@ class SecureLayer : public TQObject
Q_OBJECT Q_OBJECT
public: public:
SecureLayer(QCA::TLS *t); SecureLayer(TQCA::TLS *t);
SecureLayer(QCA::SASL *s); SecureLayer(TQCA::SASL *s);
#ifdef USE_TLSHANDLER #ifdef USE_TLSHANDLER
SecureLayer(TLSHandler *t); SecureLayer(TLSHandler *t);
#endif #endif
@ -119,8 +119,8 @@ public:
enum { TLS, SASL, TLSH }; enum { TLS, SASL, TLSH };
int type; int type;
union { union {
QCA::TLS *tls; TQCA::TLS *tls;
QCA::SASL *sasl; TQCA::SASL *sasl;
#ifdef USE_TLSHANDLER #ifdef USE_TLSHANDLER
TLSHandler *tlsHandler; TLSHandler *tlsHandler;
#endif #endif

@ -7,9 +7,9 @@ ClientStreamTest::ClientStreamTest(int argc, char ** argv) : TQApplication( argc
//myConnector->setOptHostPort( "localhost", 8300 ); //myConnector->setOptHostPort( "localhost", 8300 );
myConnector->setOptHostPort( "reiser.suse.de", 8300 ); myConnector->setOptHostPort( "reiser.suse.de", 8300 );
myConnector->setOptSSL( true ); myConnector->setOptSSL( true );
Q_ASSERT( QCA::isSupported(QCA::CAP_TLS) ); Q_ASSERT( TQCA::isSupported(TQCA::CAP_TLS) );
myTLS = new QCA::TLS; myTLS = new TQCA::TLS;
myTLSHandler = new QCATLSHandler( myTLS ); myTLSHandler = new TQCATLSHandler( myTLS );
myTestObject = new ClientStream( myConnector, myTLSHandler, 0); myTestObject = new ClientStream( myConnector, myTLSHandler, 0);
// notify when the transport layer is connected // notify when the transport layer is connected
connect( myTestObject, TQT_SIGNAL( connected() ), TQT_SLOT( slotConnected() ) ); connect( myTestObject, TQT_SIGNAL( connected() ), TQT_SLOT( slotConnected() ) );
@ -76,7 +76,7 @@ void ClientStreamTest::slotTLSHandshaken()
tqDebug( "TLS handshake complete" ); tqDebug( "TLS handshake complete" );
int validityResult = myTLS->certificateValidityResult (); int validityResult = myTLS->certificateValidityResult ();
if( validityResult == QCA::TLS::Valid ) if( validityResult == TQCA::TLS::Valid )
{ {
tqDebug( "Certificate is valid, continuing."); tqDebug( "Certificate is valid, continuing.");
// valid certificate, continue // valid certificate, continue

@ -50,8 +50,8 @@ public slots:
private: private:
KNetworkConnector *myConnector; KNetworkConnector *myConnector;
QCA::TLS *myTLS; TQCA::TLS *myTLS;
QCATLSHandler *myTLSHandler; TQCATLSHandler *myTLSHandler;
ClientStream *myTestObject; ClientStream *myTestObject;
}; };

@ -25,7 +25,7 @@
#include "filetransfer.h" #include "filetransfer.h"
#include "xmpp.h" #include "xmpp.h"
#include "xmpp_tasks.h" #include "xmpp_tasks.h"
#include "qca.h" #include <qca.h>
#include "bsocket.h" #include "bsocket.h"
#include "jabberaccount.h" #include "jabberaccount.h"
@ -421,7 +421,7 @@ void JabberAccount::connectWithPassword ( const TQString &password )
case JabberClient::NoTLS: case JabberClient::NoTLS:
// no SSL support, at the connecting stage this means the problem is client-side // no SSL support, at the connecting stage this means the problem is client-side
KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error, KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
i18n ("SSL support could not be initialized for account %1. This is most likely because the QCA TLS plugin is not installed on your system."). i18n ("SSL support could not be initialized for account %1. This is most likely because the TQCA TLS plugin is not installed on your system.").
arg(myself()->contactId()), arg(myself()->contactId()),
i18n ("Jabber SSL Error")); i18n ("Jabber SSL Error"));
break; break;
@ -451,53 +451,53 @@ bool JabberAccount::handleTLSWarning ( JabberClient *jabberClient, int warning )
switch ( warning ) switch ( warning )
{ {
case QCA::TLS::NoCert: case TQCA::TLS::NoCert:
validityString = i18n("No certificate was presented."); validityString = i18n("No certificate was presented.");
code = "NoCert"; code = "NoCert";
break; break;
case QCA::TLS::HostMismatch: case TQCA::TLS::HostMismatch:
validityString = i18n("The host name does not match the one in the certificate."); validityString = i18n("The host name does not match the one in the certificate.");
code = "HostMismatch"; code = "HostMismatch";
break; break;
case QCA::TLS::Rejected: case TQCA::TLS::Rejected:
validityString = i18n("The Certificate Authority rejected the certificate."); validityString = i18n("The Certificate Authority rejected the certificate.");
code = "Rejected"; code = "Rejected";
break; break;
case QCA::TLS::Untrusted: case TQCA::TLS::Untrusted:
// FIXME: write better error message here // FIXME: write better error message here
validityString = i18n("The certificate is untrusted."); validityString = i18n("The certificate is untrusted.");
code = "Untrusted"; code = "Untrusted";
break; break;
case QCA::TLS::SignatureFailed: case TQCA::TLS::SignatureFailed:
validityString = i18n("The signature is invalid."); validityString = i18n("The signature is invalid.");
code = "SignatureFailed"; code = "SignatureFailed";
break; break;
case QCA::TLS::InvalidCA: case TQCA::TLS::InvalidCA:
validityString = i18n("The Certificate Authority is invalid."); validityString = i18n("The Certificate Authority is invalid.");
code = "InvalidCA"; code = "InvalidCA";
break; break;
case QCA::TLS::InvalidPurpose: case TQCA::TLS::InvalidPurpose:
// FIXME: write better error message here // FIXME: write better error message here
validityString = i18n("Invalid certificate purpose."); validityString = i18n("Invalid certificate purpose.");
code = "InvalidPurpose"; code = "InvalidPurpose";
break; break;
case QCA::TLS::SelfSigned: case TQCA::TLS::SelfSigned:
validityString = i18n("The certificate is self-signed."); validityString = i18n("The certificate is self-signed.");
code = "SelfSigned"; code = "SelfSigned";
break; break;
case QCA::TLS::Revoked: case TQCA::TLS::Revoked:
validityString = i18n("The certificate has been revoked."); validityString = i18n("The certificate has been revoked.");
code = "Revoked"; code = "Revoked";
break; break;
case QCA::TLS::PathLengthExceeded: case TQCA::TLS::PathLengthExceeded:
validityString = i18n("Maximum certificate chain length was exceeded."); validityString = i18n("Maximum certificate chain length was exceeded.");
code = "PathLengthExceeded"; code = "PathLengthExceeded";
break; break;
case QCA::TLS::Expired: case TQCA::TLS::Expired:
validityString = i18n("The certificate has expired."); validityString = i18n("The certificate has expired.");
code = "Expired"; code = "Expired";
break; break;
case QCA::TLS::Unknown: case TQCA::TLS::Unknown:
default: default:
validityString = i18n("An unknown error occurred trying to validate the certificate."); validityString = i18n("An unknown error occurred trying to validate the certificate.");
code = "Unknown"; code = "Unknown";

@ -110,14 +110,14 @@ public:
/* /*
* Handle TLS warnings. Displays a dialog and returns the user's choice. * Handle TLS warnings. Displays a dialog and returns the user's choice.
* Parameters: Warning code from QCA::TLS * Parameters: Warning code from TQCA::TLS
* Automatically resumes the stream if wanted. * Automatically resumes the stream if wanted.
*/ */
/** /**
* Handle a TLS warning. Displays a dialog and returns if the * Handle a TLS warning. Displays a dialog and returns if the
* stream can be continued or not. * stream can be continued or not.
* @param client JabberClient instance * @param client JabberClient instance
* @param warning Warning code from QCA::TLS * @param warning Warning code from TQCA::TLS
* @return True if stream can be resumed. * @return True if stream can be resumed.
*/ */
static bool handleTLSWarning ( JabberClient *client, int warning ); static bool handleTLSWarning ( JabberClient *client, int warning );

@ -61,8 +61,8 @@ public:
XMPP::Client *jabberClient; XMPP::Client *jabberClient;
XMPP::ClientStream *jabberClientStream; XMPP::ClientStream *jabberClientStream;
JabberConnector *jabberClientConnector; JabberConnector *jabberClientConnector;
QCA::TLS *jabberTLS; TQCA::TLS *jabberTLS;
XMPP::QCATLSHandler *jabberTLSHandler; XMPP::TQCATLSHandler *jabberTLSHandler;
// ignore TLS warnings // ignore TLS warnings
bool ignoreTLSWarnings; bool ignoreTLSWarnings;
@ -603,7 +603,7 @@ JabberClient::ErrorCode JabberClient::connect ( const XMPP::Jid &jid, const TQSt
/* /*
* Return an error if we should force TLS but it's not available. * Return an error if we should force TLS but it's not available.
*/ */
if ( ( forceTLS () || useSSL () || probeSSL () ) && !QCA::isSupported ( QCA::CAP_TLS ) ) if ( ( forceTLS () || useSSL () || probeSSL () ) && !TQCA::isSupported ( TQCA::CAP_TLS ) )
{ {
return NoTLS; return NoTLS;
} }
@ -631,17 +631,17 @@ JabberClient::ErrorCode JabberClient::connect ( const XMPP::Jid &jid, const TQSt
/* /*
* Setup authentication layer * Setup authentication layer
*/ */
if ( QCA::isSupported ( QCA::CAP_TLS ) ) if ( TQCA::isSupported ( TQCA::CAP_TLS ) )
{ {
d->jabberTLS = new QCA::TLS; d->jabberTLS = new TQCA::TLS;
d->jabberTLSHandler = new XMPP::QCATLSHandler ( d->jabberTLS ); d->jabberTLSHandler = new XMPP::TQCATLSHandler ( d->jabberTLS );
{ {
using namespace XMPP; using namespace XMPP;
TQObject::connect ( d->jabberTLSHandler, TQT_SIGNAL ( tlsHandshaken() ), this, TQT_SLOT ( slotTLSHandshaken () ) ); TQObject::connect ( d->jabberTLSHandler, TQT_SIGNAL ( tlsHandshaken() ), this, TQT_SLOT ( slotTLSHandshaken () ) );
} }
TQPtrList<QCA::Cert> certStore; TQPtrList<TQCA::Cert> certStore;
d->jabberTLS->setCertificateStore ( certStore ); d->jabberTLS->setCertificateStore ( certStore );
} }
@ -893,10 +893,10 @@ void JabberClient::slotTLSHandshaken ()
emit debugMessage ( "TLS handshake done, testing certificate validity..." ); emit debugMessage ( "TLS handshake done, testing certificate validity..." );
// FIXME: in the future, this should be handled by KDE, not QCA // FIXME: in the future, this should be handled by KDE, not TQCA
int validityResult = d->jabberTLS->certificateValidityResult (); int validityResult = d->jabberTLS->certificateValidityResult ();
if ( validityResult == QCA::TLS::Valid ) if ( validityResult == TQCA::TLS::Valid )
{ {
emit debugMessage ( "Certificate is valid, continuing." ); emit debugMessage ( "Certificate is valid, continuing." );

@ -53,7 +53,7 @@ static TQString hpk(int n, const TQString &s)
if(n == 0) if(n == 0)
return s; return s;
else else
return Base64::arrayToString( QCA::SHA1::hash( TQCString(hpk(n - 1, s).latin1()) ) ); return Base64::arrayToString( TQCA::SHA1::hash( TQCString(hpk(n - 1, s).latin1()) ) );
} }
class HttpPoll::Private class HttpPoll::Private

@ -29,7 +29,7 @@
#include<tqxml.h> #include<tqxml.h>
#include<tqdom.h> #include<tqdom.h>
namespace QCA namespace TQCA
{ {
class TLS; class TLS;
} }
@ -189,15 +189,15 @@ namespace XMPP
void readyReadOutgoing(const TQByteArray &a, int plainBytes); void readyReadOutgoing(const TQByteArray &a, int plainBytes);
}; };
class QCATLSHandler : public TLSHandler class TQCATLSHandler : public TLSHandler
{ {
Q_OBJECT Q_OBJECT
public: public:
QCATLSHandler(QCA::TLS *parent); TQCATLSHandler(TQCA::TLS *parent);
~QCATLSHandler(); ~TQCATLSHandler();
QCA::TLS *tls() const; TQCA::TLS *tls() const;
int tlsError() const; int tlsError() const;
void reset(); void reset();
@ -457,7 +457,7 @@ namespace XMPP
}; };
ClientStream(Connector *conn, TLSHandler *tlsHandler=0, TQObject *parent=0); ClientStream(Connector *conn, TLSHandler *tlsHandler=0, TQObject *parent=0);
ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, QCA::TLS *tls=0, TQObject *parent=0); // server ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, TQCA::TLS *tls=0, TQObject *parent=0); // server
~ClientStream(); ~ClientStream();
Jid jid() const; Jid jid() const;

@ -27,7 +27,7 @@
#include<stdlib.h> #include<stdlib.h>
#include<qca.h> #include<qca.h>
#include"xmpp_xmlcommon.h" #include"xmpp_xmlcommon.h"
#include"hash.h" #include "../xmpp-core/hash.h"
#include"socks.h" #include"socks.h"
#include"safedelete.h" #include"safedelete.h"
@ -49,7 +49,7 @@ namespace XMPP {
static TQString makeKey(const TQString &sid, const Jid &initiator, const Jid &target) static TQString makeKey(const TQString &sid, const Jid &initiator, const Jid &target)
{ {
TQString str = sid + initiator.full() + target.full(); TQString str = sid + initiator.full() + target.full();
return QCA::SHA1::hashToString(str.utf8()); return TQCA::SHA1::hashToString(str.utf8());
} }
static bool haveHost(const StreamHostList &list, const Jid &j) static bool haveHost(const StreamHostList &list, const Jid &j)
@ -579,8 +579,8 @@ S5BManager::S5BManager(Client *parent)
:TQObject(parent) :TQObject(parent)
{ {
// S5B needs SHA1 // S5B needs SHA1
if(!QCA::isSupported(QCA::CAP_SHA1)) if(!TQCA::isSupported(TQCA::CAP_SHA1))
QCA::insertProvider(createProviderHash()); TQCA::insertProvider(createProviderHash());
d = new Private; d = new Private;
d->client = parent; d->client = parent;

@ -1,6 +1,6 @@
# The only Q_OBJECT lines are in securestream.{h,cpp} and we deal with them below. # The only Q_OBJECT lines are in securestream.{h,cpp} and we deal with them below.
# Give metasources a file with no Q_OBJECT line to stop unsermake assuming we want METASOURCES = AUTO # Give metasources a file with no Q_OBJECT line to stop unsermake assuming we want METASOURCES = AUTO
METASOURCES = AUTO #METASOURCES = AUTO
noinst_LTLIBRARIES = libiris_xmpp_core.la noinst_LTLIBRARIES = libiris_xmpp_core.la
AM_CPPFLAGS = $(IDN_CFLAGS) AM_CPPFLAGS = $(IDN_CFLAGS)

@ -321,8 +321,8 @@ void AdvancedConnector::connectToServer(const TQString &server)
if(d->proxy.type() == Proxy::HttpPoll) { if(d->proxy.type() == Proxy::HttpPoll) {
// need SHA1 here // need SHA1 here
if(!QCA::isSupported(QCA::CAP_SHA1)) if(!TQCA::isSupported(TQCA::CAP_SHA1))
QCA::insertProvider(createProviderHash()); TQCA::insertProvider(createProviderHash());
HttpPoll *s = new HttpPoll; HttpPoll *s = new HttpPoll;
d->bs = s; d->bs = s;

@ -447,7 +447,7 @@ typedef union {
TQ_UINT32 l[16]; TQ_UINT32 l[16];
} CHAR64LONG16; } CHAR64LONG16;
class SHA1Context : public QCA_HashContext class SHA1Context : public TQCA_HashContext
{ {
public: public:
SHA1_CONTEXT _context; SHA1_CONTEXT _context;
@ -458,7 +458,7 @@ public:
reset(); reset();
} }
QCA_HashContext *clone() TQCA_HashContext *clone()
{ {
return new SHA1Context(*this); return new SHA1Context(*this);
} }
@ -598,7 +598,7 @@ public:
} }
}; };
class MD5Context : public QCA_HashContext class MD5Context : public TQCA_HashContext
{ {
public: public:
MD5Context() MD5Context()
@ -606,7 +606,7 @@ public:
reset(); reset();
} }
QCA_HashContext *clone() TQCA_HashContext *clone()
{ {
return new MD5Context(*this); return new MD5Context(*this);
} }
@ -631,7 +631,7 @@ public:
md5_state_t md5; md5_state_t md5;
}; };
class HashProvider : public QCAProvider class HashProvider : public TQCAProvider
{ {
public: public:
HashProvider() {} HashProvider() {}
@ -644,25 +644,25 @@ public:
int qcaVersion() const int qcaVersion() const
{ {
return QCA_PLUGIN_VERSION; return TQCA_PLUGIN_VERSION;
} }
int capabilities() const int capabilities() const
{ {
return (QCA::CAP_SHA1 | QCA::CAP_MD5); return (TQCA::CAP_SHA1 | TQCA::CAP_MD5);
} }
void *context(int cap) void *context(int cap)
{ {
if(cap == QCA::CAP_SHA1) if(cap == TQCA::CAP_SHA1)
return new SHA1Context; return new SHA1Context;
if(cap == QCA::CAP_MD5) if(cap == TQCA::CAP_MD5)
return new MD5Context; return new MD5Context;
return 0; return 0;
} }
}; };
QCAProvider *createProviderHash() TQCAProvider *createProviderHash()
{ {
return (new HashProvider); return (new HashProvider);
} }

@ -21,11 +21,11 @@
#ifndef HASH_H #ifndef HASH_H
#define HASH_H #define HASH_H
#include"qcaprovider.h" #include <qcaprovider.h>
namespace XMPP namespace XMPP
{ {
QCAProvider *createProviderHash(); TQCAProvider *createProviderHash();
} }
#endif #endif

@ -1189,12 +1189,12 @@ bool CoreProtocol::normalStep(const TQDomElement &e)
TQDomElement p; TQDomElement p;
if(digest) { if(digest) {
// need SHA1 here // need SHA1 here
if(!QCA::isSupported(QCA::CAP_SHA1)) if(!TQCA::isSupported(TQCA::CAP_SHA1))
QCA::insertProvider(createProviderHash()); TQCA::insertProvider(createProviderHash());
p = doc.createElement("digest"); p = doc.createElement("digest");
TQCString cs = id.utf8() + password.utf8(); TQCString cs = id.utf8() + password.utf8();
p.appendChild(doc.createTextNode(QCA::SHA1::hashToString(cs))); p.appendChild(doc.createTextNode(TQCA::SHA1::hashToString(cs)));
} }
else { else {
p = doc.createElement("password"); p = doc.createElement("password");

@ -1,191 +0,0 @@
/*
* qcaprovider.h - QCA Plugin API
* Copyright (C) 2003 Justin Karneges
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef QCAPROVIDER_H
#define QCAPROVIDER_H
#include<tqglobal.h>
#include<tqstring.h>
#include<tqdatetime.h>
#include<tqobject.h>
#include<tqhostaddress.h>
#include"qca.h"
#define QCA_PLUGIN_VERSION 1
class QCAProvider
{
public:
QCAProvider() {}
virtual ~QCAProvider() {}
virtual void init()=0;
virtual int qcaVersion() const=0;
virtual int capabilities() const=0;
virtual void *context(int cap)=0;
};
class QCA_HashContext
{
public:
virtual ~QCA_HashContext() {}
virtual QCA_HashContext *clone()=0;
virtual void reset()=0;
virtual void update(const char *in, unsigned int len)=0;
virtual void final(TQByteArray *out)=0;
};
class QCA_CipherContext
{
public:
virtual ~QCA_CipherContext() {}
virtual QCA_CipherContext *clone()=0;
virtual int keySize()=0;
virtual int blockSize()=0;
virtual bool generateKey(char *out, int keysize=-1)=0;
virtual bool generateIV(char *out)=0;
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(TQByteArray *out)=0;
};
class QCA_RSAKeyContext
{
public:
virtual ~QCA_RSAKeyContext() {}
virtual QCA_RSAKeyContext *clone() const=0;
virtual bool isNull() const=0;
virtual bool havePublic() const=0;
virtual bool havePrivate() const=0;
virtual bool createFromDER(const char *in, unsigned int len)=0;
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(TQByteArray *out, bool publicOnly)=0;
virtual bool toPEM(TQByteArray *out, bool publicOnly)=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
{
TQString var;
TQString val;
};
class QCA_CertContext
{
public:
virtual ~QCA_CertContext() {}
virtual QCA_CertContext *clone() const=0;
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(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<QCA_CertProperty> subject() const=0;
virtual TQValueList<QCA_CertProperty> issuer() const=0;
virtual TQDateTime notBefore() const=0;
virtual TQDateTime notAfter() const=0;
virtual bool matchesAddress(const TQString &realHost) const=0;
};
class QCA_TLSContext
{
public:
enum Result { Success, Error, Continue };
virtual ~QCA_TLSContext() {}
virtual void reset()=0;
virtual bool startClient(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
virtual bool startServer(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=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 TQByteArray unprocessed()=0;
virtual QCA_CertContext *peerCertificate() const=0;
virtual int validityResult() const=0;
};
struct QCA_SASLHostPort
{
TQHostAddress addr;
TQ_UINT16 port;
};
struct QCA_SASLNeedParams
{
bool user, authzid, pass, realm;
};
class QCA_SASLContext
{
public:
enum Result { Success, Error, NeedParams, AuthCheck, Continue };
virtual ~QCA_SASLContext() {}
// common
virtual void reset()=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 TQStringList &mechlist)=0;
virtual int clientFirstStep(bool allowClientSendFirst)=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 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 TQByteArray &in)=0;
virtual int tryAgain()=0;
// results
virtual TQString mech() const=0;
virtual const TQByteArray *clientInit() const=0;
virtual TQByteArray result() const=0;
// security layer
virtual bool encode(const TQByteArray &in, TQByteArray *out)=0;
virtual bool decode(const TQByteArray &in, TQByteArray *out)=0;
};
#endif

@ -22,7 +22,7 @@
Note: SecureStream depends on the underlying security layers to signal Note: SecureStream depends on the underlying security layers to signal
plain-to-encrypted results immediately (as opposed to waiting for the plain-to-encrypted results immediately (as opposed to waiting for the
event loop) so that the user cannot add/remove security layers during event loop) so that the user cannot add/remove security layers during
this conversion moment. QCA::TLS and QCA::SASL behave as expected, this conversion moment. TQCA::TLS and TQCA::SASL behave as expected,
but future layers might not. but future layers might not.
*/ */
@ -117,8 +117,8 @@ public:
enum { TLS, SASL, TLSH }; enum { TLS, SASL, TLSH };
int type; int type;
union { union {
QCA::TLS *tls; TQCA::TLS *tls;
QCA::SASL *sasl; TQCA::SASL *sasl;
#ifdef USE_TLSHANDLER #ifdef USE_TLSHANDLER
XMPP::TLSHandler *tlsHandler; XMPP::TLSHandler *tlsHandler;
#endif #endif
@ -127,7 +127,7 @@ public:
bool tls_done; bool tls_done;
int prebytes; int prebytes;
SecureLayer(QCA::TLS *t) SecureLayer(TQCA::TLS *t)
{ {
type = TLS; type = TLS;
p.tls = t; p.tls = t;
@ -139,7 +139,7 @@ public:
connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int))); connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
} }
SecureLayer(QCA::SASL *s) SecureLayer(TQCA::SASL *s)
{ {
type = SASL; type = SASL;
p.sasl = s; p.sasl = s;
@ -381,7 +381,7 @@ int SecureStream::calcPrebytes() const
return (d->pending - x); return (d->pending - x);
} }
void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &spare) void SecureStream::startTLSClient(TQCA::TLS *t, const TQByteArray &spare)
{ {
if(!d->active || d->topInProgress || d->haveTLS()) if(!d->active || d->topInProgress || d->haveTLS())
return; return;
@ -395,7 +395,7 @@ void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &spare)
insertData(spare); insertData(spare);
} }
void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &spare) void SecureStream::startTLSServer(TQCA::TLS *t, const TQByteArray &spare)
{ {
if(!d->active || d->topInProgress || d->haveTLS()) if(!d->active || d->topInProgress || d->haveTLS())
return; return;
@ -409,7 +409,7 @@ void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &spare)
insertData(spare); insertData(spare);
} }
void SecureStream::setLayerSASL(QCA::SASL *sasl, const TQByteArray &spare) void SecureStream::setLayerSASL(TQCA::SASL *sasl, const TQByteArray &spare)
{ {
if(!d->active || d->topInProgress || d->haveSASL()) if(!d->active || d->topInProgress || d->haveSASL())
return; return;
@ -434,7 +434,7 @@ void SecureStream::startTLSClient(XMPP::TLSHandler *t, const TQString &server, c
d->layers.append(s); d->layers.append(s);
d->topInProgress = true; d->topInProgress = true;
// unlike QCA::TLS, XMPP::TLSHandler has no return value // unlike TQCA::TLS, XMPP::TLSHandler has no return value
s->p.tlsHandler->startClient(server); s->p.tlsHandler->startClient(server);
insertData(spare); insertData(spare);

@ -42,9 +42,9 @@ public:
SecureStream(ByteStream *s); SecureStream(ByteStream *s);
~SecureStream(); ~SecureStream();
void startTLSClient(QCA::TLS *t, const TQByteArray &spare=TQByteArray()); void startTLSClient(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
void startTLSServer(QCA::TLS *t, const TQByteArray &spare=TQByteArray()); void startTLSServer(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
void setLayerSASL(QCA::SASL *s, const TQByteArray &spare=TQByteArray()); void setLayerSASL(TQCA::SASL *s, const TQByteArray &spare=TQByteArray());
#ifdef USE_TLSHANDLER #ifdef USE_TLSHANDLER
void startTLSClient(XMPP::TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray()); void startTLSClient(XMPP::TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray());
#endif #endif

@ -143,7 +143,7 @@ public:
} }
}; };
class SimpleSASLContext : public QCA_SASLContext class SimpleSASLContext : public TQCA_SASLContext
{ {
public: public:
// core props // core props
@ -157,8 +157,8 @@ public:
bool capable; bool capable;
int err; int err;
QCA_SASLNeedParams need; TQCA_SASLNeedParams need;
QCA_SASLNeedParams have; TQCA_SASLNeedParams have;
TQString user, authz, pass, realm; TQString user, authz, pass, realm;
SimpleSASLContext() SimpleSASLContext()
@ -201,7 +201,7 @@ public:
realm = TQString(); realm = TQString();
} }
void setCoreProps(const TQString &_service, const TQString &_host, QCA_SASLHostPort *, QCA_SASLHostPort *) void setCoreProps(const TQString &_service, const TQString &_host, TQCA_SASLHostPort *, TQCA_SASLHostPort *)
{ {
service = _service; service = _service;
host = _host; host = _host;
@ -235,7 +235,7 @@ public:
} }
} }
if(!capable || !haveMech) { if(!capable || !haveMech) {
err = QCA::SASL::NoMech; err = TQCA::SASL::NoMech;
return false; return false;
} }
@ -259,7 +259,7 @@ public:
return Error; return Error;
} }
QCA_SASLNeedParams clientParamsNeeded() const TQCA_SASLNeedParams clientParamsNeeded() const
{ {
return need; return need;
} }
@ -352,7 +352,7 @@ public:
TQCString cs(in_buf.data(), in_buf.size()+1); TQCString cs(in_buf.data(), in_buf.size()+1);
PropList in; PropList in;
if(!in.fromString(cs)) { if(!in.fromString(cs)) {
err = QCA::SASL::BadProto; err = TQCA::SASL::BadProto;
return Error; return Error;
} }
@ -371,16 +371,16 @@ public:
// build 'response' // build 'response'
TQCString X = user.utf8() + ':' + realm.utf8() + ':' + pass.utf8(); TQCString X = user.utf8() + ':' + realm.utf8() + ':' + pass.utf8();
TQByteArray Y = QCA::MD5::hash(X); TQByteArray Y = TQCA::MD5::hash(X);
TQCString tmp = TQCString(":") + nonce + ':' + cnonce + ':' + authz.utf8(); TQCString tmp = TQCString(":") + nonce + ':' + cnonce + ':' + authz.utf8();
TQByteArray A1(Y.size() + tmp.length()); TQByteArray A1(Y.size() + tmp.length());
memcpy(A1.data(), Y.data(), Y.size()); memcpy(A1.data(), Y.data(), Y.size());
memcpy(A1.data() + Y.size(), tmp.data(), tmp.length()); memcpy(A1.data() + Y.size(), tmp.data(), tmp.length());
TQCString A2 = "AUTHENTICATE:" + uri; TQCString A2 = "AUTHENTICATE:" + uri;
TQCString HA1 = QCA::MD5::hashToString(A1).latin1(); TQCString HA1 = TQCA::MD5::hashToString(A1).latin1();
TQCString HA2 = QCA::MD5::hashToString(A2).latin1(); TQCString HA2 = TQCA::MD5::hashToString(A2).latin1();
TQCString KD = HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2; TQCString KD = HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2;
TQCString Z = QCA::MD5::hashToString(KD).latin1(); TQCString Z = TQCA::MD5::hashToString(KD).latin1();
// build output // build output
PropList out; PropList out;
@ -423,11 +423,11 @@ public:
} }
}; };
class QCASimpleSASL : public QCAProvider class TQCASimpleSASL : public TQCAProvider
{ {
public: public:
QCASimpleSASL() {} TQCASimpleSASL() {}
~QCASimpleSASL() {} ~TQCASimpleSASL() {}
void init() void init()
{ {
@ -435,25 +435,25 @@ public:
int qcaVersion() const int qcaVersion() const
{ {
return QCA_PLUGIN_VERSION; return TQCA_PLUGIN_VERSION;
} }
int capabilities() const int capabilities() const
{ {
return QCA::CAP_SASL; return TQCA::CAP_SASL;
} }
void *context(int cap) void *context(int cap)
{ {
if(cap == QCA::CAP_SASL) if(cap == TQCA::CAP_SASL)
return new SimpleSASLContext; return new SimpleSASLContext;
return 0; return 0;
} }
}; };
QCAProvider *createProviderSimpleSASL() TQCAProvider *createProviderSimpleSASL()
{ {
return (new QCASimpleSASL); return (new TQCASimpleSASL);
} }
} }

@ -21,11 +21,11 @@
#ifndef SIMPLESASL_H #ifndef SIMPLESASL_H
#define SIMPLESASL_H #define SIMPLESASL_H
#include"qcaprovider.h" #include <qcaprovider.h>
namespace XMPP namespace XMPP
{ {
QCAProvider *createProviderSimpleSASL(); TQCAProvider *createProviderSimpleSASL();
} }
#endif #endif

@ -81,10 +81,10 @@ static TQByteArray randomArray(int size)
static TQString genId() static TQString genId()
{ {
// need SHA1 here // need SHA1 here
if(!QCA::isSupported(QCA::CAP_SHA1)) if(!TQCA::isSupported(TQCA::CAP_SHA1))
QCA::insertProvider(createProviderHash()); TQCA::insertProvider(createProviderHash());
return QCA::SHA1::hashToString(randomArray(128)); return TQCA::SHA1::hashToString(randomArray(128));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -584,8 +584,8 @@ public:
Connector *conn; Connector *conn;
ByteStream *bs; ByteStream *bs;
TLSHandler *tlsHandler; TLSHandler *tlsHandler;
QCA::TLS *tls; TQCA::TLS *tls;
QCA::SASL *sasl; TQCA::SASL *sasl;
SecureStream *ss; SecureStream *ss;
CoreProtocol client; CoreProtocol client;
CoreProtocol srv; CoreProtocol srv;
@ -627,7 +627,7 @@ ClientStream::ClientStream(Connector *conn, TLSHandler *tlsHandler, TQObject *pa
d->tlsHandler = tlsHandler; d->tlsHandler = tlsHandler;
} }
ClientStream::ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, QCA::TLS *tls, TQObject *parent) ClientStream::ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, TQCA::TLS *tls, TQObject *parent)
:Stream(parent) :Stream(parent)
{ {
d = new Private; d = new Private;
@ -1162,7 +1162,7 @@ void ClientStream::srvProcessNext()
} }
else if(need == CoreProtocol::NSASLMechs) { else if(need == CoreProtocol::NSASLMechs) {
if(!d->sasl) { if(!d->sasl) {
d->sasl = new QCA::SASL; d->sasl = new TQCA::SASL;
connect(d->sasl, TQT_SIGNAL(authCheck(const TQString &, const TQString &)), TQT_SLOT(sasl_authCheck(const TQString &, const TQString &))); connect(d->sasl, TQT_SIGNAL(authCheck(const TQString &, const TQString &)), TQT_SLOT(sasl_authCheck(const TQString &, const TQString &)));
connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &))); connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &)));
connect(d->sasl, TQT_SIGNAL(authenticated()), TQT_SLOT(sasl_authenticated())); connect(d->sasl, TQT_SIGNAL(authenticated()), TQT_SLOT(sasl_authenticated()));
@ -1241,9 +1241,9 @@ void ClientStream::srvProcessNext()
printf("Break (RecvOpen)\n"); printf("Break (RecvOpen)\n");
// calculate key // calculate key
TQCString str = QCA::SHA1::hashToString(TQCString("secret")).utf8(); TQCString str = TQCA::SHA1::hashToString(TQCString("secret")).utf8();
str = QCA::SHA1::hashToString(str + "im.pyxa.org").utf8(); str = TQCA::SHA1::hashToString(str + "im.pyxa.org").utf8();
str = QCA::SHA1::hashToString(str + d->srv.id.utf8()).utf8(); str = TQCA::SHA1::hashToString(str + d->srv.id.utf8()).utf8();
d->srv.setDialbackKey(str); d->srv.setDialbackKey(str);
//d->srv.setDialbackKey("3c5d721ea2fcc45b163a11420e4e358f87e3142a"); //d->srv.setDialbackKey("3c5d721ea2fcc45b163a11420e4e358f87e3142a");
@ -1472,14 +1472,14 @@ bool ClientStream::handleNeed()
printf("Need SASL First Step\n"); printf("Need SASL First Step\n");
#endif #endif
// no SASL plugin? fall back to Simple SASL // no SASL plugin? fall back to Simple SASL
if(!QCA::isSupported(QCA::CAP_SASL)) { if(!TQCA::isSupported(TQCA::CAP_SASL)) {
// Simple SASL needs MD5. do we have that either? // Simple SASL needs MD5. do we have that either?
if(!QCA::isSupported(QCA::CAP_MD5)) if(!TQCA::isSupported(TQCA::CAP_MD5))
QCA::insertProvider(createProviderHash()); TQCA::insertProvider(createProviderHash());
QCA::insertProvider(createProviderSimpleSASL()); TQCA::insertProvider(createProviderSimpleSASL());
} }
d->sasl = new QCA::SASL; d->sasl = new TQCA::SASL;
connect(d->sasl, TQT_SIGNAL(clientFirstStep(const TQString &, const TQByteArray *)), TQT_SLOT(sasl_clientFirstStep(const TQString &, const TQByteArray *))); connect(d->sasl, TQT_SIGNAL(clientFirstStep(const TQString &, const TQByteArray *)), TQT_SLOT(sasl_clientFirstStep(const TQString &, const TQByteArray *)));
connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &))); connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &)));
connect(d->sasl, TQT_SIGNAL(needParams(bool, bool, bool, bool)), TQT_SLOT(sasl_needParams(bool, bool, bool, bool))); connect(d->sasl, TQT_SIGNAL(needParams(bool, bool, bool, bool)), TQT_SLOT(sasl_needParams(bool, bool, bool, bool)));
@ -1557,13 +1557,13 @@ bool ClientStream::handleNeed()
int ClientStream::convertedSASLCond() const int ClientStream::convertedSASLCond() const
{ {
int x = d->sasl->errorCondition(); int x = d->sasl->errorCondition();
if(x == QCA::SASL::NoMech) if(x == TQCA::SASL::NoMech)
return NoMech; return NoMech;
else if(x == QCA::SASL::BadProto) else if(x == TQCA::SASL::BadProto)
return BadProto; return BadProto;
else if(x == QCA::SASL::BadServ) else if(x == TQCA::SASL::BadServ)
return BadServ; return BadServ;
else if(x == QCA::SASL::TooWeak) else if(x == TQCA::SASL::TooWeak)
return MechTooWeak; return MechTooWeak;
else else
return GenericAuthError; return GenericAuthError;

@ -21,7 +21,7 @@
#include"xmpp.h" #include"xmpp.h"
#include<tqtimer.h> #include<tqtimer.h>
#include"qca.h" #include <qca.h>
using namespace XMPP; using namespace XMPP;
@ -39,16 +39,16 @@ TLSHandler::~TLSHandler()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// QCATLSHandler // TQCATLSHandler
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class QCATLSHandler::Private class TQCATLSHandler::Private
{ {
public: public:
QCA::TLS *tls; TQCA::TLS *tls;
int state, err; int state, err;
}; };
QCATLSHandler::QCATLSHandler(QCA::TLS *parent) TQCATLSHandler::TQCATLSHandler(TQCA::TLS *parent)
:TLSHandler(parent) :TLSHandler(parent)
{ {
d = new Private; d = new Private;
@ -62,28 +62,28 @@ QCATLSHandler::QCATLSHandler(QCA::TLS *parent)
d->err = -1; d->err = -1;
} }
QCATLSHandler::~QCATLSHandler() TQCATLSHandler::~TQCATLSHandler()
{ {
delete d; delete d;
} }
QCA::TLS *QCATLSHandler::tls() const TQCA::TLS *TQCATLSHandler::tls() const
{ {
return d->tls; return d->tls;
} }
int QCATLSHandler::tlsError() const int TQCATLSHandler::tlsError() const
{ {
return d->err; return d->err;
} }
void QCATLSHandler::reset() void TQCATLSHandler::reset()
{ {
d->tls->reset(); d->tls->reset();
d->state = 0; d->state = 0;
} }
void QCATLSHandler::startClient(const TQString &host) void TQCATLSHandler::startClient(const TQString &host)
{ {
d->state = 0; d->state = 0;
d->err = -1; d->err = -1;
@ -91,17 +91,17 @@ void QCATLSHandler::startClient(const TQString &host)
TQTimer::singleShot(0, this, TQT_SIGNAL(fail())); TQTimer::singleShot(0, this, TQT_SIGNAL(fail()));
} }
void QCATLSHandler::write(const TQByteArray &a) void TQCATLSHandler::write(const TQByteArray &a)
{ {
d->tls->write(a); d->tls->write(a);
} }
void QCATLSHandler::writeIncoming(const TQByteArray &a) void TQCATLSHandler::writeIncoming(const TQByteArray &a)
{ {
d->tls->writeIncoming(a); d->tls->writeIncoming(a);
} }
void QCATLSHandler::continueAfterHandshake() void TQCATLSHandler::continueAfterHandshake()
{ {
if(d->state == 2) { if(d->state == 2) {
success(); success();
@ -109,28 +109,28 @@ void QCATLSHandler::continueAfterHandshake()
} }
} }
void QCATLSHandler::tls_handshaken() void TQCATLSHandler::tls_handshaken()
{ {
d->state = 2; d->state = 2;
tlsHandshaken(); tlsHandshaken();
} }
void QCATLSHandler::tls_readyRead() void TQCATLSHandler::tls_readyRead()
{ {
readyRead(d->tls->read()); readyRead(d->tls->read());
} }
void QCATLSHandler::tls_readyReadOutgoing(int plainBytes) void TQCATLSHandler::tls_readyReadOutgoing(int plainBytes)
{ {
readyReadOutgoing(d->tls->readOutgoing(), plainBytes); readyReadOutgoing(d->tls->readOutgoing(), plainBytes);
} }
void QCATLSHandler::tls_closed() void TQCATLSHandler::tls_closed()
{ {
closed(); closed();
} }
void QCATLSHandler::tls_error(int x) void TQCATLSHandler::tls_error(int x)
{ {
d->err = x; d->err = x;
d->state = 0; d->state = 0;

@ -1,4 +1,4 @@
Installing QCA Installing TQCA
-------------- --------------
Installation should be straightforward: Installation should be straightforward:

@ -23,7 +23,7 @@ regulation.
And of course, you get a very simple crypto API for Qt, where you can And of course, you get a very simple crypto API for Qt, where you can
do things like: do things like:
QString hash = QCA::SHA1::hashToString(blockOfData); QString hash = TQCA::SHA1::hashToString(blockOfData);
Have fun! Have fun!

@ -40,12 +40,12 @@
#define PLUGIN_EXT "so" #define PLUGIN_EXT "so"
#endif #endif
using namespace QCA; using namespace TQCA;
class ProviderItem class ProviderItem
{ {
public: public:
QCAProvider *p; TQCAProvider *p;
TQString fname; TQString fname;
static ProviderItem *load(const TQString &fname) static ProviderItem *load(const TQString &fname)
@ -60,8 +60,8 @@ public:
delete lib; delete lib;
return 0; return 0;
} }
QCAProvider *(*createProvider)() = (QCAProvider *(*)())s; TQCAProvider *(*createProvider)() = (TQCAProvider *(*)())s;
QCAProvider *p = createProvider(); TQCAProvider *p = createProvider();
if(!p) { if(!p) {
delete lib; delete lib;
return 0; return 0;
@ -71,7 +71,7 @@ public:
return i; return i;
} }
static ProviderItem *fromClass(QCAProvider *p) static ProviderItem *fromClass(TQCAProvider *p)
{ {
ProviderItem *i = new ProviderItem(0, p); ProviderItem *i = new ProviderItem(0, p);
return i; return i;
@ -95,7 +95,7 @@ private:
TQLibrary *lib; TQLibrary *lib;
bool init_done; bool init_done;
ProviderItem(TQLibrary *_lib, QCAProvider *_p) ProviderItem(TQLibrary *_lib, TQCAProvider *_p)
{ {
lib = _lib; lib = _lib;
p = _p; p = _p;
@ -142,7 +142,7 @@ static void plugin_scan()
ProviderItem *i = ProviderItem::load(fname); ProviderItem *i = ProviderItem::load(fname);
if(!i) if(!i)
continue; continue;
if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) { if(i->p->qcaVersion() != TQCA_PLUGIN_VERSION) {
delete i; delete i;
continue; continue;
} }
@ -152,7 +152,7 @@ static void plugin_scan()
} }
} }
static void plugin_addClass(QCAProvider *p) static void plugin_addClass(TQCAProvider *p)
{ {
ProviderItem *i = ProviderItem::fromClass(p); ProviderItem *i = ProviderItem::fromClass(p);
providerList.prepend(i); providerList.prepend(i);
@ -172,7 +172,7 @@ static int plugin_caps()
return caps; return caps;
} }
TQString QCA::arrayToHex(const TQByteArray &a) TQString TQCA::arrayToHex(const TQByteArray &a)
{ {
TQString out; TQString out;
for(int n = 0; n < (int)a.size(); ++n) { for(int n = 0; n < (int)a.size(); ++n) {
@ -183,7 +183,7 @@ TQString QCA::arrayToHex(const TQByteArray &a)
return out; return out;
} }
TQByteArray QCA::hexToArray(const TQString &str) TQByteArray TQCA::hexToArray(const TQString &str)
{ {
TQByteArray out(str.length() / 2); TQByteArray out(str.length() / 2);
int at = 0; int at = 0;
@ -196,7 +196,7 @@ TQByteArray QCA::hexToArray(const TQString &str)
return out; return out;
} }
void QCA::init() void TQCA::init()
{ {
if(qca_init) if(qca_init)
return; return;
@ -204,7 +204,7 @@ void QCA::init()
providerList.setAutoDelete(true); providerList.setAutoDelete(true);
} }
bool QCA::isSupported(int capabilities) bool TQCA::isSupported(int capabilities)
{ {
init(); init();
@ -221,12 +221,12 @@ bool QCA::isSupported(int capabilities)
return false; return false;
} }
void QCA::insertProvider(QCAProvider *p) void TQCA::insertProvider(TQCAProvider *p)
{ {
plugin_addClass(p); plugin_addClass(p);
} }
void QCA::unloadAllPlugins() void TQCA::unloadAllPlugins()
{ {
plugin_unloadall(); plugin_unloadall();
} }
@ -236,7 +236,7 @@ static void *getContext(int cap)
init(); init();
// this call will also trip a scan for new plugins if needed // this call will also trip a scan for new plugins if needed
if(!QCA::isSupported(cap)) if(!TQCA::isSupported(cap))
return 0; return 0;
TQPtrListIterator<ProviderItem> it(providerList); TQPtrListIterator<ProviderItem> it(providerList);
@ -271,10 +271,10 @@ public:
c->reset(); c->reset();
} }
QCA_HashContext *c; TQCA_HashContext *c;
}; };
Hash::Hash(QCA_HashContext *c) Hash::Hash(TQCA_HashContext *c)
{ {
d = new Private; d = new Private;
d->c = c; d->c = c;
@ -340,14 +340,14 @@ public:
err = false; err = false;
} }
QCA_CipherContext *c; TQCA_CipherContext *c;
int dir; int dir;
int mode; int mode;
TQByteArray key, iv; TQByteArray key, iv;
bool err; bool err;
}; };
Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad) Cipher::Cipher(TQCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
{ {
d = new Private; d = new Private;
d->c = c; d->c = c;
@ -447,7 +447,7 @@ TQByteArray Cipher::final(bool *ok)
// SHA1 // SHA1
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SHA1::SHA1() SHA1::SHA1()
:Hash((QCA_HashContext *)getContext(CAP_SHA1)) :Hash((TQCA_HashContext *)getContext(CAP_SHA1))
{ {
} }
@ -456,7 +456,7 @@ SHA1::SHA1()
// SHA256 // SHA256
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SHA256::SHA256() SHA256::SHA256()
:Hash((QCA_HashContext *)getContext(CAP_SHA256)) :Hash((TQCA_HashContext *)getContext(CAP_SHA256))
{ {
} }
@ -465,7 +465,7 @@ SHA256::SHA256()
// MD5 // MD5
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
MD5::MD5() MD5::MD5()
:Hash((QCA_HashContext *)getContext(CAP_MD5)) :Hash((TQCA_HashContext *)getContext(CAP_MD5))
{ {
} }
@ -474,7 +474,7 @@ MD5::MD5()
// BlowFish // BlowFish
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
{ {
} }
@ -483,7 +483,7 @@ BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray
// TripleDES // TripleDES
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
{ {
} }
@ -492,7 +492,7 @@ TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArra
// AES128 // AES128
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
{ {
} }
@ -501,7 +501,7 @@ AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv,
// AES256 // AES256
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &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) :Cipher((TQCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
{ {
} }
@ -522,13 +522,13 @@ public:
delete c; delete c;
} }
QCA_RSAKeyContext *c; TQCA_RSAKeyContext *c;
}; };
RSAKey::RSAKey() RSAKey::RSAKey()
{ {
d = new Private; d = new Private;
d->c = (QCA_RSAKeyContext *)getContext(CAP_RSA); d->c = (TQCA_RSAKeyContext *)getContext(CAP_RSA);
} }
RSAKey::RSAKey(const RSAKey &from) RSAKey::RSAKey(const RSAKey &from)
@ -685,13 +685,13 @@ public:
delete c; delete c;
} }
QCA_CertContext *c; TQCA_CertContext *c;
}; };
Cert::Cert() Cert::Cert()
{ {
d = new Private; d = new Private;
d->c = (QCA_CertContext *)getContext(CAP_X509); d->c = (TQCA_CertContext *)getContext(CAP_X509);
} }
Cert::Cert(const Cert &from) Cert::Cert(const Cert &from)
@ -712,7 +712,7 @@ Cert::~Cert()
delete d; delete d;
} }
void Cert::fromContext(QCA_CertContext *ctx) void Cert::fromContext(TQCA_CertContext *ctx)
{ {
delete d->c; delete d->c;
d->c = ctx; d->c = ctx;
@ -746,18 +746,18 @@ TQString Cert::issuerString() const
CertProperties Cert::subject() const CertProperties Cert::subject() const
{ {
TQValueList<QCA_CertProperty> list = d->c->subject(); TQValueList<TQCA_CertProperty> list = d->c->subject();
CertProperties props; CertProperties props;
for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it) for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
props[(*it).var] = (*it).val; props[(*it).var] = (*it).val;
return props; return props;
} }
CertProperties Cert::issuer() const CertProperties Cert::issuer() const
{ {
TQValueList<QCA_CertProperty> list = d->c->issuer(); TQValueList<TQCA_CertProperty> list = d->c->issuer();
CertProperties props; CertProperties props;
for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it) for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
props[(*it).var] = (*it).val; props[(*it).var] = (*it).val;
return props; return props;
} }
@ -814,7 +814,7 @@ class TLS::Private
public: public:
Private() Private()
{ {
c = (QCA_TLSContext *)getContext(CAP_TLS); c = (TQCA_TLSContext *)getContext(CAP_TLS);
} }
~Private() ~Private()
@ -845,7 +845,7 @@ public:
} }
Cert cert; Cert cert;
QCA_TLSContext *c; TQCA_TLSContext *c;
TQByteArray in, out, to_net, from_net; TQByteArray in, out, to_net, from_net;
int bytesEncoded; int bytesEncoded;
bool tryMore; bool tryMore;
@ -856,7 +856,7 @@ public:
Cert ourCert; Cert ourCert;
RSAKey ourKey; RSAKey ourKey;
TQPtrList<QCA_CertContext> store; TQPtrList<TQCA_CertContext> store;
}; };
TLS::TLS(TQObject *parent) TLS::TLS(TQObject *parent)
@ -966,7 +966,7 @@ const Cert & TLS::peerCertificate() const
int TLS::certificateValidityResult() const int TLS::certificateValidityResult() const
{ {
if(d->hostMismatch) if(d->hostMismatch)
return QCA::TLS::HostMismatch; return TQCA::TLS::HostMismatch;
else else
return d->c->validityResult(); return d->c->validityResult();
} }
@ -982,12 +982,12 @@ void TLS::update()
TQByteArray a; TQByteArray a;
int r = d->c->shutdown(d->from_net, &a); int r = d->c->shutdown(d->from_net, &a);
d->from_net.resize(0); d->from_net.resize(0);
if(r == QCA_TLSContext::Error) { if(r == TQCA_TLSContext::Error) {
reset(); reset();
error(ErrHandshake); error(ErrHandshake);
return; return;
} }
if(r == QCA_TLSContext::Success) { if(r == TQCA_TLSContext::Success) {
d->from_net = d->c->unprocessed().copy(); d->from_net = d->c->unprocessed().copy();
done = true; done = true;
} }
@ -998,15 +998,15 @@ void TLS::update()
TQByteArray a; TQByteArray a;
int r = d->c->handshake(d->from_net, &a); int r = d->c->handshake(d->from_net, &a);
d->from_net.resize(0); d->from_net.resize(0);
if(r == QCA_TLSContext::Error) { if(r == TQCA_TLSContext::Error) {
reset(); reset();
error(ErrHandshake); error(ErrHandshake);
return; return;
} }
d->appendArray(&d->to_net, a); d->appendArray(&d->to_net, a);
if(r == QCA_TLSContext::Success) { if(r == TQCA_TLSContext::Success) {
QCA_CertContext *cc = d->c->peerCertificate(); TQCA_CertContext *cc = d->c->peerCertificate();
if(cc && !d->host.isEmpty() && d->c->validityResult() == QCA::TLS::Valid) { if(cc && !d->host.isEmpty() && d->c->validityResult() == TQCA::TLS::Valid) {
if(!cc->matchesAddress(d->host)) if(!cc->matchesAddress(d->host))
d->hostMismatch = true; d->hostMismatch = true;
} }
@ -1097,7 +1097,7 @@ class SASL::Private
public: public:
Private() Private()
{ {
c = (QCA_SASLContext *)getContext(CAP_SASL); c = (TQCA_SASLContext *)getContext(CAP_SASL);
} }
~Private() ~Private()
@ -1117,7 +1117,7 @@ public:
int ext_ssf; int ext_ssf;
bool tried; bool tried;
QCA_SASLContext *c; TQCA_SASLContext *c;
TQHostAddress localAddr, remoteAddr; TQHostAddress localAddr, remoteAddr;
int localPort, remotePort; int localPort, remotePort;
TQByteArray stepData; TQByteArray stepData;
@ -1241,7 +1241,7 @@ void SASL::setRemoteAddr(const TQHostAddress &addr, TQ_UINT16 port)
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst) bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
{ {
QCA_SASLHostPort la, ra; TQCA_SASLHostPort la, ra;
if(d->localPort != -1) { if(d->localPort != -1) {
la.addr = d->localAddr; la.addr = d->localAddr;
la.port = d->localPort; la.port = d->localPort;
@ -1266,7 +1266,7 @@ bool SASL::startClient(const TQString &service, const TQString &host, const TQSt
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist) bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
{ {
QCA_SASLHostPort la, ra; TQCA_SASLHostPort la, ra;
if(d->localPort != -1) { if(d->localPort != -1) {
la.addr = d->localAddr; la.addr = d->localAddr;
la.port = d->localPort; la.port = d->localPort;
@ -1301,11 +1301,11 @@ void SASL::putServerFirstStep(const TQString &mech, const TQByteArray &clientIni
void SASL::handleServerFirstStep(int r) void SASL::handleServerFirstStep(int r)
{ {
if(r == QCA_SASLContext::Success) if(r == TQCA_SASLContext::Success)
authenticated(); authenticated();
else if(r == QCA_SASLContext::Continue) else if(r == TQCA_SASLContext::Continue)
nextStep(d->c->result()); nextStep(d->c->result());
else if(r == QCA_SASLContext::AuthCheck) else if(r == TQCA_SASLContext::AuthCheck)
tryAgain(); tryAgain();
else else
error(ErrAuth); error(ErrAuth);
@ -1360,16 +1360,16 @@ void SASL::tryAgain()
r = d->c->tryAgain(); r = d->c->tryAgain();
} }
if(r == QCA_SASLContext::Error) { if(r == TQCA_SASLContext::Error) {
error(ErrAuth); error(ErrAuth);
return; return;
} }
else if(r == QCA_SASLContext::Continue) { else if(r == TQCA_SASLContext::Continue) {
d->tried = false; d->tried = false;
nextStep(d->c->result()); nextStep(d->c->result());
return; return;
} }
else if(r == QCA_SASLContext::AuthCheck) { else if(r == TQCA_SASLContext::AuthCheck) {
authCheck(d->c->username(), d->c->authzid()); authCheck(d->c->username(), d->c->authzid());
return; return;
} }
@ -1383,13 +1383,13 @@ void SASL::tryAgain()
else else
r = d->c->tryAgain(); r = d->c->tryAgain();
if(r == QCA_SASLContext::Error) { if(r == TQCA_SASLContext::Error) {
error(ErrAuth); error(ErrAuth);
return; return;
} }
else if(r == QCA_SASLContext::NeedParams) { else if(r == TQCA_SASLContext::NeedParams) {
//d->tried = false; //d->tried = false;
QCA_SASLNeedParams np = d->c->clientParamsNeeded(); TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
needParams(np.user, np.authzid, np.pass, np.realm); needParams(np.user, np.authzid, np.pass, np.realm);
return; return;
} }
@ -1409,27 +1409,27 @@ void SASL::tryAgain()
else else
r = d->c->tryAgain(); r = d->c->tryAgain();
if(r == QCA_SASLContext::Error) { if(r == TQCA_SASLContext::Error) {
error(ErrAuth); error(ErrAuth);
return; return;
} }
else if(r == QCA_SASLContext::NeedParams) { else if(r == TQCA_SASLContext::NeedParams) {
//d->tried = false; //d->tried = false;
QCA_SASLNeedParams np = d->c->clientParamsNeeded(); TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
needParams(np.user, np.authzid, np.pass, np.realm); needParams(np.user, np.authzid, np.pass, np.realm);
return; return;
} }
d->tried = false; d->tried = false;
//else if(r == QCA_SASLContext::Continue) { //else if(r == TQCA_SASLContext::Continue) {
nextStep(d->c->result()); nextStep(d->c->result());
// return; // return;
//} //}
} }
} }
if(r == QCA_SASLContext::Success) if(r == TQCA_SASLContext::Success)
authenticated(); authenticated();
else if(r == QCA_SASLContext::Error) else if(r == TQCA_SASLContext::Error)
error(ErrAuth); error(ErrAuth);
} }

@ -18,8 +18,8 @@
* *
*/ */
#ifndef QCA_H #ifndef TQCA_H
#define QCA_H #define TQCA_H
#include<tqstring.h> #include<tqstring.h>
#include<tqcstring.h> #include<tqcstring.h>
@ -29,38 +29,38 @@
#include<tqobject.h> #include<tqobject.h>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
# ifndef QCA_STATIC # ifndef TQCA_STATIC
# ifdef QCA_MAKEDLL # ifdef TQCA_MAKEDLL
# define QCA_EXPORT __declspec(dllexport) # define TQCA_EXPORT __declspec(dllexport)
# else # else
# define QCA_EXPORT __declspec(dllimport) # define TQCA_EXPORT __declspec(dllimport)
# endif # endif
# endif # endif
#endif #endif
#ifndef QCA_EXPORT #ifndef TQCA_EXPORT
#define QCA_EXPORT #define TQCA_EXPORT
#endif #endif
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
# ifdef QCA_PLUGIN_DLL # ifdef TQCA_PLUGIN_DLL
# define QCA_PLUGIN_EXPORT extern "C" __declspec(dllexport) # define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllexport)
# else # else
# define QCA_PLUGIN_EXPORT extern "C" __declspec(dllimport) # define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllimport)
# endif # endif
#endif #endif
#ifndef QCA_PLUGIN_EXPORT #ifndef TQCA_PLUGIN_EXPORT
#define QCA_PLUGIN_EXPORT extern "C" #define TQCA_PLUGIN_EXPORT extern "C"
#endif #endif
class TQHostAddress; class TQHostAddress;
class TQStringList; class TQStringList;
class QCAProvider; class TQCAProvider;
class QCA_HashContext; class TQCA_HashContext;
class QCA_CipherContext; class TQCA_CipherContext;
class QCA_CertContext; class TQCA_CertContext;
namespace QCA namespace TQCA
{ {
enum { enum {
CAP_SHA1 = 0x0001, CAP_SHA1 = 0x0001,
@ -86,15 +86,15 @@ namespace QCA
Decrypt = 0x0002 Decrypt = 0x0002
}; };
QCA_EXPORT void init(); TQCA_EXPORT void init();
QCA_EXPORT bool isSupported(int capabilities); TQCA_EXPORT bool isSupported(int capabilities);
QCA_EXPORT void insertProvider(QCAProvider *); TQCA_EXPORT void insertProvider(TQCAProvider *);
QCA_EXPORT void unloadAllPlugins(); TQCA_EXPORT void unloadAllPlugins();
QCA_EXPORT TQString arrayToHex(const TQByteArray &); TQCA_EXPORT TQString arrayToHex(const TQByteArray &);
QCA_EXPORT TQByteArray hexToArray(const TQString &); TQCA_EXPORT TQByteArray hexToArray(const TQString &);
class QCA_EXPORT Hash class TQCA_EXPORT Hash
{ {
public: public:
Hash(const Hash &); Hash(const Hash &);
@ -106,7 +106,7 @@ namespace QCA
TQByteArray final(); TQByteArray final();
protected: protected:
Hash(QCA_HashContext *); Hash(TQCA_HashContext *);
private: private:
class Private; class Private;
@ -114,7 +114,7 @@ namespace QCA
}; };
template <class T> template <class T>
class QCA_EXPORT HashStatic class TQCA_EXPORT HashStatic
{ {
public: public:
HashStatic<T>() {} HashStatic<T>() {}
@ -144,7 +144,7 @@ namespace QCA
} }
}; };
class QCA_EXPORT Cipher class TQCA_EXPORT Cipher
{ {
public: public:
Cipher(const Cipher &); Cipher(const Cipher &);
@ -158,7 +158,7 @@ namespace QCA
TQByteArray final(bool *ok=0); TQByteArray final(bool *ok=0);
protected: protected:
Cipher(QCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad); Cipher(TQCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad);
private: private:
class Private; class Private;
@ -166,7 +166,7 @@ namespace QCA
}; };
template <class T> template <class T>
class QCA_EXPORT CipherStatic class TQCA_EXPORT CipherStatic
{ {
public: public:
CipherStatic<T>() {} CipherStatic<T>() {}
@ -184,50 +184,50 @@ namespace QCA
} }
}; };
class QCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1> class TQCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1>
{ {
public: public:
SHA1(); SHA1();
}; };
class QCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256> class TQCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256>
{ {
public: public:
SHA256(); SHA256();
}; };
class QCA_EXPORT MD5 : public Hash, public HashStatic<MD5> class TQCA_EXPORT MD5 : public Hash, public HashStatic<MD5>
{ {
public: public:
MD5(); MD5();
}; };
class QCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish> class TQCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish>
{ {
public: public:
BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), 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<TripleDES> class TQCA_EXPORT TripleDES : public Cipher, public CipherStatic<TripleDES>
{ {
public: public:
TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), 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<AES128> class TQCA_EXPORT AES128 : public Cipher, public CipherStatic<AES128>
{ {
public: public:
AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), 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<AES256> class TQCA_EXPORT AES256 : public Cipher, public CipherStatic<AES256>
{ {
public: public:
AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true); AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
}; };
class RSA; class RSA;
class QCA_EXPORT RSAKey class TQCA_EXPORT RSAKey
{ {
public: public:
RSAKey(); RSAKey();
@ -259,7 +259,7 @@ namespace QCA
bool generate(unsigned int bits); bool generate(unsigned int bits);
}; };
class QCA_EXPORT RSA class TQCA_EXPORT RSA
{ {
public: public:
RSA(); RSA();
@ -278,7 +278,7 @@ namespace QCA
}; };
typedef TQMap<TQString, TQString> CertProperties; typedef TQMap<TQString, TQString> CertProperties;
class QCA_EXPORT Cert class TQCA_EXPORT Cert
{ {
public: public:
Cert(); Cert();
@ -308,10 +308,10 @@ namespace QCA
Private *d; Private *d;
friend class TLS; friend class TLS;
void fromContext(QCA_CertContext *); void fromContext(TQCA_CertContext *);
}; };
class QCA_EXPORT TLS : public TQObject class TQCA_EXPORT TLS : public TQObject
{ {
Q_OBJECT Q_OBJECT
@ -373,7 +373,7 @@ namespace QCA
Private *d; Private *d;
}; };
class QCA_EXPORT SASL : public TQObject class TQCA_EXPORT SASL : public TQObject
{ {
Q_OBJECT Q_OBJECT

@ -1,5 +1,5 @@
/* /*
* qcaprovider.h - QCA Plugin API * qcaprovider.h - TQCA Plugin API
* Copyright (C) 2003 Justin Karneges * Copyright (C) 2003 Justin Karneges
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -18,8 +18,8 @@
* *
*/ */
#ifndef QCAPROVIDER_H #ifndef TQCAPROVIDER_H
#define QCAPROVIDER_H #define TQCAPROVIDER_H
#include<tqglobal.h> #include<tqglobal.h>
#include<tqstring.h> #include<tqstring.h>
@ -28,13 +28,13 @@
#include<tqhostaddress.h> #include<tqhostaddress.h>
#include"qca.h" #include"qca.h"
#define QCA_PLUGIN_VERSION 1 #define TQCA_PLUGIN_VERSION 1
class QCAProvider class TQCAProvider
{ {
public: public:
QCAProvider() {} TQCAProvider() {}
virtual ~QCAProvider() {} virtual ~TQCAProvider() {}
virtual void init()=0; virtual void init()=0;
virtual int qcaVersion() const=0; virtual int qcaVersion() const=0;
@ -42,23 +42,23 @@ public:
virtual void *context(int cap)=0; virtual void *context(int cap)=0;
}; };
class QCA_HashContext class TQCA_HashContext
{ {
public: public:
virtual ~QCA_HashContext() {} virtual ~TQCA_HashContext() {}
virtual QCA_HashContext *clone()=0; virtual TQCA_HashContext *clone()=0;
virtual void reset()=0; virtual void reset()=0;
virtual void update(const char *in, unsigned int len)=0; virtual void update(const char *in, unsigned int len)=0;
virtual void final(TQByteArray *out)=0; virtual void final(TQByteArray *out)=0;
}; };
class QCA_CipherContext class TQCA_CipherContext
{ {
public: public:
virtual ~QCA_CipherContext() {} virtual ~TQCA_CipherContext() {}
virtual QCA_CipherContext *clone()=0; virtual TQCA_CipherContext *clone()=0;
virtual int keySize()=0; virtual int keySize()=0;
virtual int blockSize()=0; virtual int blockSize()=0;
virtual bool generateKey(char *out, int keysize=-1)=0; virtual bool generateKey(char *out, int keysize=-1)=0;
@ -69,12 +69,12 @@ public:
virtual bool final(TQByteArray *out)=0; virtual bool final(TQByteArray *out)=0;
}; };
class QCA_RSAKeyContext class TQCA_RSAKeyContext
{ {
public: public:
virtual ~QCA_RSAKeyContext() {} virtual ~TQCA_RSAKeyContext() {}
virtual QCA_RSAKeyContext *clone() const=0; virtual TQCA_RSAKeyContext *clone() const=0;
virtual bool isNull() const=0; virtual bool isNull() const=0;
virtual bool havePublic() const=0; virtual bool havePublic() const=0;
virtual bool havePrivate() const=0; virtual bool havePrivate() const=0;
@ -89,18 +89,18 @@ public:
virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0; virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
}; };
struct QCA_CertProperty struct TQCA_CertProperty
{ {
TQString var; TQString var;
TQString val; TQString val;
}; };
class QCA_CertContext class TQCA_CertContext
{ {
public: public:
virtual ~QCA_CertContext() {} virtual ~TQCA_CertContext() {}
virtual QCA_CertContext *clone() const=0; virtual TQCA_CertContext *clone() const=0;
virtual bool isNull() const=0; virtual bool isNull() const=0;
virtual bool createFromDER(const char *in, unsigned int len)=0; virtual bool createFromDER(const char *in, unsigned int len)=0;
virtual bool createFromPEM(const char *in, unsigned int len)=0; virtual bool createFromPEM(const char *in, unsigned int len)=0;
@ -110,22 +110,22 @@ public:
virtual TQString serialNumber() const=0; virtual TQString serialNumber() const=0;
virtual TQString subjectString() const=0; virtual TQString subjectString() const=0;
virtual TQString issuerString() const=0; virtual TQString issuerString() const=0;
virtual TQValueList<QCA_CertProperty> subject() const=0; virtual TQValueList<TQCA_CertProperty> subject() const=0;
virtual TQValueList<QCA_CertProperty> issuer() const=0; virtual TQValueList<TQCA_CertProperty> issuer() const=0;
virtual TQDateTime notBefore() const=0; virtual TQDateTime notBefore() const=0;
virtual TQDateTime notAfter() const=0; virtual TQDateTime notAfter() const=0;
virtual bool matchesAddress(const TQString &realHost) const=0; virtual bool matchesAddress(const TQString &realHost) const=0;
}; };
class QCA_TLSContext class TQCA_TLSContext
{ {
public: public:
enum Result { Success, Error, Continue }; enum Result { Success, Error, Continue };
virtual ~QCA_TLSContext() {} virtual ~TQCA_TLSContext() {}
virtual void reset()=0; virtual void reset()=0;
virtual bool startClient(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; virtual bool startClient(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
virtual bool startServer(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0; virtual bool startServer(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
virtual int handshake(const TQByteArray &in, TQByteArray *out)=0; virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0; virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
@ -134,30 +134,30 @@ public:
virtual bool eof() const=0; virtual bool eof() const=0;
virtual TQByteArray unprocessed()=0; virtual TQByteArray unprocessed()=0;
virtual QCA_CertContext *peerCertificate() const=0; virtual TQCA_CertContext *peerCertificate() const=0;
virtual int validityResult() const=0; virtual int validityResult() const=0;
}; };
struct QCA_SASLHostPort struct TQCA_SASLHostPort
{ {
TQHostAddress addr; TQHostAddress addr;
TQ_UINT16 port; TQ_UINT16 port;
}; };
struct QCA_SASLNeedParams struct TQCA_SASLNeedParams
{ {
bool user, authzid, pass, realm; bool user, authzid, pass, realm;
}; };
class QCA_SASLContext class TQCA_SASLContext
{ {
public: public:
enum Result { Success, Error, NeedParams, AuthCheck, Continue }; enum Result { Success, Error, NeedParams, AuthCheck, Continue };
virtual ~QCA_SASLContext() {} virtual ~TQCA_SASLContext() {}
// common // common
virtual void reset()=0; virtual void reset()=0;
virtual void setCoreProps(const TQString &service, const TQString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0; virtual void setCoreProps(const TQString &service, const TQString &host, TQCA_SASLHostPort *local, TQCA_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 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 security() const=0;
virtual int errorCond() const=0; virtual int errorCond() const=0;
@ -169,7 +169,7 @@ public:
virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0; virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
// get / set params // get / set params
virtual QCA_SASLNeedParams clientParamsNeeded() const=0; virtual TQCA_SASLNeedParams clientParamsNeeded() const=0;
virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0; virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
virtual TQString username() const=0; virtual TQString username() const=0;
virtual TQString authzid() const=0; virtual TQString authzid() const=0;

@ -33,7 +33,7 @@
#include <tqtimer.h> #include <tqtimer.h>
#include <tqregexp.h> #include <tqregexp.h>
#include "qca.h" #include <qca.h>
#include "xmpp.h" #include "xmpp.h"
#include "xmpp_tasks.h" #include "xmpp_tasks.h"
@ -264,7 +264,7 @@ void JabberRegisterAccount::slotOk ()
case JabberClient::NoTLS: case JabberClient::NoTLS:
// no SSL support, at the connecting stage this means the problem is client-side // no SSL support, at the connecting stage this means the problem is client-side
KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error, KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
i18n ("SSL support could not be initialized for account %1. This is most likely because the QCA TLS plugin is not installed on your system."). i18n ("SSL support could not be initialized for account %1. This is most likely because the TQCA TLS plugin is not installed on your system.").
arg ( mMainWidget->leJID->text () ), arg ( mMainWidget->leJID->text () ),
i18n ("Jabber SSL Error")); i18n ("Jabber SSL Error"));
break; break;

Loading…
Cancel
Save