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 "client.h"
#include "qca.h"
#include <qca.h>
#include "gwcontact.h"
#include "gwcontactlist.h"
#include "gwprotocol.h"
@ -87,7 +87,7 @@ GroupWiseAccount::GroupWiseAccount( GroupWiseProtocol *parent, const TQString& a
TQT_SLOT( slotPrivacy() ), this, "actionPrivacy");
m_connector = 0;
m_QCATLS = 0;
m_TQCATLS = 0;
m_tlsHandler = 0;
m_clientStream = 0;
m_client = 0;
@ -243,12 +243,12 @@ void GroupWiseAccount::performConnectWithPassword( const TQString &password )
if ( isConnected () )
return;
bool sslPossible = QCA::isSupported(QCA::CAP_TLS);
bool sslPossible = TQCA::isSupported(TQCA::CAP_TLS);
if (!sslPossible)
{
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()),
i18n ("GroupWise SSL Error"));
return;
@ -263,9 +263,9 @@ void GroupWiseAccount::performConnectWithPassword( const TQString &password )
//myConnector->setOptHostPort( "localhost", 8300 );
m_connector->setOptHostPort( server(), port() );
m_connector->setOptSSL( true );
Q_ASSERT( QCA::isSupported(QCA::CAP_TLS) );
m_QCATLS = new QCA::TLS;
m_tlsHandler = new QCATLSHandler( m_QCATLS );
Q_ASSERT( TQCA::isSupported(TQCA::CAP_TLS) );
m_TQCATLS = new TQCA::TLS;
m_tlsHandler = new TQCATLSHandler( m_TQCATLS );
m_clientStream = new ClientStream( m_connector, m_tlsHandler, 0);
TQObject::connect( m_connector, TQT_SIGNAL( error() ), this, TQT_SLOT( slotConnError() ) );
@ -439,11 +439,11 @@ void GroupWiseAccount::cleanup()
{
delete m_client;
delete m_clientStream;
delete m_QCATLS;
delete m_TQCATLS;
delete m_connector;
m_connector = 0;
m_QCATLS = 0;
m_TQCATLS = 0;
m_clientStream = 0;
m_client = 0;
}
@ -687,9 +687,9 @@ void GroupWiseAccount::slotCSWarning( int warning )
void GroupWiseAccount::slotTLSHandshaken()
{
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;
// valid certificate, continue
@ -716,53 +716,53 @@ int GroupWiseAccount::handleTLSWarning (int warning, TQString server, TQString a
switch(warning)
{
case QCA::TLS::NoCert:
case TQCA::TLS::NoCert:
validityString = i18n("No certificate was presented.");
code = "NoCert";
break;
case QCA::TLS::HostMismatch:
case TQCA::TLS::HostMismatch:
validityString = i18n("The host name does not match the one in the certificate.");
code = "HostMismatch";
break;
case QCA::TLS::Rejected:
case TQCA::TLS::Rejected:
validityString = i18n("The Certificate Authority rejected the certificate.");
code = "Rejected";
break;
case QCA::TLS::Untrusted:
case TQCA::TLS::Untrusted:
// FIXME: write better error message here
validityString = i18n("The certificate is untrusted.");
code = "Untrusted";
break;
case QCA::TLS::SignatureFailed:
case TQCA::TLS::SignatureFailed:
validityString = i18n("The signature is invalid.");
code = "SignatureFailed";
break;
case QCA::TLS::InvalidCA:
case TQCA::TLS::InvalidCA:
validityString = i18n("The Certificate Authority is invalid.");
code = "InvalidCA";
break;
case QCA::TLS::InvalidPurpose:
case TQCA::TLS::InvalidPurpose:
// FIXME: write better error message here
validityString = i18n("Invalid certificate purpose.");
code = "InvalidPurpose";
break;
case QCA::TLS::SelfSigned:
case TQCA::TLS::SelfSigned:
validityString = i18n("The certificate is self-signed.");
code = "SelfSigned";
break;
case QCA::TLS::Revoked:
case TQCA::TLS::Revoked:
validityString = i18n("The certificate has been revoked.");
code = "Revoked";
break;
case QCA::TLS::PathLengthExceeded:
case TQCA::TLS::PathLengthExceeded:
validityString = i18n("Maximum certificate chain length was exceeded.");
code = "PathLengthExceeded";
break;
case QCA::TLS::Expired:
case TQCA::TLS::Expired:
validityString = i18n("The certificate has expired.");
code = "Expired";
break;
case QCA::TLS::Unknown:
case TQCA::TLS::Unknown:
default:
validityString = i18n("An unknown error occurred trying to validate the certificate.");
code = "Unknown";

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

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

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

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

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

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

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

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

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

@ -22,7 +22,7 @@
Note: SecureStream depends on the underlying security layers to signal
plain-to-encrypted results immediately (as opposed to waiting for the
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.
*/
@ -86,7 +86,7 @@ int LayerTracker::finished(int encoded)
// SecureStream
//----------------------------------------------------------------------------
SecureLayer::SecureLayer(QCA::TLS *t)
SecureLayer::SecureLayer(TQCA::TLS *t)
{
type = TLS;
p.tls = t;
@ -98,7 +98,7 @@ SecureLayer::SecureLayer(QCA::TLS *t)
connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
}
SecureLayer::SecureLayer(QCA::SASL *s)
SecureLayer::SecureLayer(TQCA::SASL *s)
{
type = SASL;
p.sasl = s;
@ -329,7 +329,7 @@ int SecureStream::calcPrebytes() const
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())
return;
@ -343,7 +343,7 @@ void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &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())
return;
@ -357,7 +357,7 @@ void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &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())
return;
@ -382,7 +382,7 @@ void SecureStream::startTLSClient(TLSHandler *t, const TQString &server, const T
d->layers.append(s);
d->topInProgress = true;
// unlike QCA::TLS, TLSHandler has no return value
// unlike TQCA::TLS, TLSHandler has no return value
s->p.tlsHandler->startClient(server);
insertData(spare);

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

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

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

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

@ -110,14 +110,14 @@ public:
/*
* 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.
*/
/**
* Handle a TLS warning. Displays a dialog and returns if the
* stream can be continued or not.
* @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.
*/
static bool handleTLSWarning ( JabberClient *client, int warning );

@ -61,8 +61,8 @@ public:
XMPP::Client *jabberClient;
XMPP::ClientStream *jabberClientStream;
JabberConnector *jabberClientConnector;
QCA::TLS *jabberTLS;
XMPP::QCATLSHandler *jabberTLSHandler;
TQCA::TLS *jabberTLS;
XMPP::TQCATLSHandler *jabberTLSHandler;
// ignore TLS warnings
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.
*/
if ( ( forceTLS () || useSSL () || probeSSL () ) && !QCA::isSupported ( QCA::CAP_TLS ) )
if ( ( forceTLS () || useSSL () || probeSSL () ) && !TQCA::isSupported ( TQCA::CAP_TLS ) )
{
return NoTLS;
}
@ -631,17 +631,17 @@ JabberClient::ErrorCode JabberClient::connect ( const XMPP::Jid &jid, const TQSt
/*
* Setup authentication layer
*/
if ( QCA::isSupported ( QCA::CAP_TLS ) )
if ( TQCA::isSupported ( TQCA::CAP_TLS ) )
{
d->jabberTLS = new QCA::TLS;
d->jabberTLSHandler = new XMPP::QCATLSHandler ( d->jabberTLS );
d->jabberTLS = new TQCA::TLS;
d->jabberTLSHandler = new XMPP::TQCATLSHandler ( d->jabberTLS );
{
using namespace XMPP;
TQObject::connect ( d->jabberTLSHandler, TQT_SIGNAL ( tlsHandshaken() ), this, TQT_SLOT ( slotTLSHandshaken () ) );
}
TQPtrList<QCA::Cert> certStore;
TQPtrList<TQCA::Cert> certStore;
d->jabberTLS->setCertificateStore ( certStore );
}
@ -893,10 +893,10 @@ void JabberClient::slotTLSHandshaken ()
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 ();
if ( validityResult == QCA::TLS::Valid )
if ( validityResult == TQCA::TLS::Valid )
{
emit debugMessage ( "Certificate is valid, continuing." );

@ -53,7 +53,7 @@ static TQString hpk(int n, const TQString &s)
if(n == 0)
return s;
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

@ -29,7 +29,7 @@
#include<tqxml.h>
#include<tqdom.h>
namespace QCA
namespace TQCA
{
class TLS;
}
@ -189,15 +189,15 @@ namespace XMPP
void readyReadOutgoing(const TQByteArray &a, int plainBytes);
};
class QCATLSHandler : public TLSHandler
class TQCATLSHandler : public TLSHandler
{
Q_OBJECT
public:
QCATLSHandler(QCA::TLS *parent);
~QCATLSHandler();
TQCATLSHandler(TQCA::TLS *parent);
~TQCATLSHandler();
QCA::TLS *tls() const;
TQCA::TLS *tls() const;
int tlsError() const;
void reset();
@ -457,7 +457,7 @@ namespace XMPP
};
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();
Jid jid() const;

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

@ -1,6 +1,6 @@
# 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
METASOURCES = AUTO
#METASOURCES = AUTO
noinst_LTLIBRARIES = libiris_xmpp_core.la
AM_CPPFLAGS = $(IDN_CFLAGS)

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

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

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

@ -1189,12 +1189,12 @@ bool CoreProtocol::normalStep(const TQDomElement &e)
TQDomElement p;
if(digest) {
// need SHA1 here
if(!QCA::isSupported(QCA::CAP_SHA1))
QCA::insertProvider(createProviderHash());
if(!TQCA::isSupported(TQCA::CAP_SHA1))
TQCA::insertProvider(createProviderHash());
p = doc.createElement("digest");
TQCString cs = id.utf8() + password.utf8();
p.appendChild(doc.createTextNode(QCA::SHA1::hashToString(cs)));
p.appendChild(doc.createTextNode(TQCA::SHA1::hashToString(cs)));
}
else {
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
plain-to-encrypted results immediately (as opposed to waiting for the
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.
*/
@ -117,8 +117,8 @@ public:
enum { TLS, SASL, TLSH };
int type;
union {
QCA::TLS *tls;
QCA::SASL *sasl;
TQCA::TLS *tls;
TQCA::SASL *sasl;
#ifdef USE_TLSHANDLER
XMPP::TLSHandler *tlsHandler;
#endif
@ -127,7 +127,7 @@ public:
bool tls_done;
int prebytes;
SecureLayer(QCA::TLS *t)
SecureLayer(TQCA::TLS *t)
{
type = TLS;
p.tls = t;
@ -139,7 +139,7 @@ public:
connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
}
SecureLayer(QCA::SASL *s)
SecureLayer(TQCA::SASL *s)
{
type = SASL;
p.sasl = s;
@ -381,7 +381,7 @@ int SecureStream::calcPrebytes() const
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())
return;
@ -395,7 +395,7 @@ void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &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())
return;
@ -409,7 +409,7 @@ void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &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())
return;
@ -434,7 +434,7 @@ void SecureStream::startTLSClient(XMPP::TLSHandler *t, const TQString &server, c
d->layers.append(s);
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);
insertData(spare);

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

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

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

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

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

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

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

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

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

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

@ -33,7 +33,7 @@
#include <tqtimer.h>
#include <tqregexp.h>
#include "qca.h"
#include <qca.h>
#include "xmpp.h"
#include "xmpp_tasks.h"
@ -264,7 +264,7 @@ void JabberRegisterAccount::slotOk ()
case JabberClient::NoTLS:
// no SSL support, at the connecting stage this means the problem is client-side
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 () ),
i18n ("Jabber SSL Error"));
break;

Loading…
Cancel
Save