By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1040
Collapse All | Expand All

(-)tdenetwork/kopete/protocols/groupwise/gwaccount.cpp (-22 / +22 lines)
Lines 87-93 Link Here
87
			TQT_SLOT( slotPrivacy() ), this, "actionPrivacy");
87
			TQT_SLOT( slotPrivacy() ), this, "actionPrivacy");
88
			
88
			
89
	m_connector = 0;
89
	m_connector = 0;
90
	m_QCATLS = 0;
90
	m_TQCATLS = 0;
91
	m_tlsHandler = 0;
91
	m_tlsHandler = 0;
92
	m_clientStream = 0;
92
	m_clientStream = 0;
93
	m_client = 0;
93
	m_client = 0;
Lines 243-254 Link Here
243
	if ( isConnected () )
243
	if ( isConnected () )
244
		return;
244
		return;
245
245
246
	bool sslPossible = QCA::isSupported(QCA::CAP_TLS);
246
	bool sslPossible = TQCA::isSupported(TQCA::CAP_TLS);
247
247
248
	if (!sslPossible)
248
	if (!sslPossible)
249
	{
249
	{
250
		KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
250
		KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
251
							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.").
251
							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.").
252
							arg(myself()->contactId()),
252
							arg(myself()->contactId()),
253
							i18n ("GroupWise SSL Error"));
253
							i18n ("GroupWise SSL Error"));
254
		return;
254
		return;
Lines 263-271 Link Here
263
	//myConnector->setOptHostPort( "localhost", 8300 );
263
	//myConnector->setOptHostPort( "localhost", 8300 );
264
	m_connector->setOptHostPort( server(), port() );
264
	m_connector->setOptHostPort( server(), port() );
265
	m_connector->setOptSSL( true );
265
	m_connector->setOptSSL( true );
266
	Q_ASSERT( QCA::isSupported(QCA::CAP_TLS) );
266
	Q_ASSERT( TQCA::isSupported(TQCA::CAP_TLS) );
267
	m_QCATLS = new QCA::TLS;
267
	m_TQCATLS = new TQCA::TLS;
268
	m_tlsHandler = new QCATLSHandler( m_QCATLS );
268
	m_tlsHandler = new TQCATLSHandler( m_TQCATLS );
269
	m_clientStream = new ClientStream( m_connector, m_tlsHandler, 0);
269
	m_clientStream = new ClientStream( m_connector, m_tlsHandler, 0);
270
270
271
	TQObject::connect( m_connector, TQT_SIGNAL( error() ), this, TQT_SLOT( slotConnError() ) );
271
	TQObject::connect( m_connector, TQT_SIGNAL( error() ), this, TQT_SLOT( slotConnError() ) );
Lines 439-449 Link Here
439
{
439
{
440
	delete m_client;
440
	delete m_client;
441
	delete m_clientStream;
441
	delete m_clientStream;
442
	delete m_QCATLS;
442
	delete m_TQCATLS;
443
	delete m_connector;
443
	delete m_connector;
444
444
445
	m_connector = 0;
445
	m_connector = 0;
446
	m_QCATLS = 0;
446
	m_TQCATLS = 0;
447
	m_clientStream = 0;
447
	m_clientStream = 0;
448
	m_client = 0;
448
	m_client = 0;
449
}
449
}
Lines 687-695 Link Here
687
void GroupWiseAccount::slotTLSHandshaken()
687
void GroupWiseAccount::slotTLSHandshaken()
688
{
688
{
689
	kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << "TLS handshake complete" << endl;
689
	kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << k_funcinfo << "TLS handshake complete" << endl;
690
	int validityResult = m_QCATLS->certificateValidityResult ();
690
	int validityResult = m_TQCATLS->certificateValidityResult ();
691
691
692
	if( validityResult == QCA::TLS::Valid )
692
	if( validityResult == TQCA::TLS::Valid )
693
	{
693
	{
694
		kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << "Certificate is valid, continuing." << endl;
694
		kdDebug ( GROUPWISE_DEBUG_GLOBAL ) << "Certificate is valid, continuing." << endl;
695
		// valid certificate, continue
695
		// valid certificate, continue
Lines 716-768 Link Here
716
716
717
	switch(warning)
717
	switch(warning)
718
	{
718
	{
719
		case QCA::TLS::NoCert:
719
		case TQCA::TLS::NoCert:
720
			validityString = i18n("No certificate was presented.");
720
			validityString = i18n("No certificate was presented.");
721
			code = "NoCert";
721
			code = "NoCert";
722
			break;
722
			break;
723
		case QCA::TLS::HostMismatch:
723
		case TQCA::TLS::HostMismatch:
724
			validityString = i18n("The host name does not match the one in the certificate.");
724
			validityString = i18n("The host name does not match the one in the certificate.");
725
			code = "HostMismatch";
725
			code = "HostMismatch";
726
			break;
726
			break;
727
		case QCA::TLS::Rejected:
727
		case TQCA::TLS::Rejected:
728
			validityString = i18n("The Certificate Authority rejected the certificate.");
728
			validityString = i18n("The Certificate Authority rejected the certificate.");
729
			code = "Rejected";
729
			code = "Rejected";
730
			break;
730
			break;
731
		case QCA::TLS::Untrusted:
731
		case TQCA::TLS::Untrusted:
732
			// FIXME: write better error message here
732
			// FIXME: write better error message here
733
			validityString = i18n("The certificate is untrusted.");
733
			validityString = i18n("The certificate is untrusted.");
734
			code = "Untrusted";
734
			code = "Untrusted";
735
			break;
735
			break;
736
		case QCA::TLS::SignatureFailed:
736
		case TQCA::TLS::SignatureFailed:
737
			validityString = i18n("The signature is invalid.");
737
			validityString = i18n("The signature is invalid.");
738
			code = "SignatureFailed";
738
			code = "SignatureFailed";
739
			break;
739
			break;
740
		case QCA::TLS::InvalidCA:
740
		case TQCA::TLS::InvalidCA:
741
			validityString = i18n("The Certificate Authority is invalid.");
741
			validityString = i18n("The Certificate Authority is invalid.");
742
			code = "InvalidCA";
742
			code = "InvalidCA";
743
			break;
743
			break;
744
		case QCA::TLS::InvalidPurpose:
744
		case TQCA::TLS::InvalidPurpose:
745
			// FIXME: write better error  message here
745
			// FIXME: write better error  message here
746
			validityString = i18n("Invalid certificate purpose.");
746
			validityString = i18n("Invalid certificate purpose.");
747
			code = "InvalidPurpose";
747
			code = "InvalidPurpose";
748
			break;
748
			break;
749
		case QCA::TLS::SelfSigned:
749
		case TQCA::TLS::SelfSigned:
750
			validityString = i18n("The certificate is self-signed.");
750
			validityString = i18n("The certificate is self-signed.");
751
			code = "SelfSigned";
751
			code = "SelfSigned";
752
			break;
752
			break;
753
		case QCA::TLS::Revoked:
753
		case TQCA::TLS::Revoked:
754
			validityString = i18n("The certificate has been revoked.");
754
			validityString = i18n("The certificate has been revoked.");
755
			code = "Revoked";
755
			code = "Revoked";
756
			break;
756
			break;
757
		case QCA::TLS::PathLengthExceeded:
757
		case TQCA::TLS::PathLengthExceeded:
758
			validityString = i18n("Maximum certificate chain length was exceeded.");
758
			validityString = i18n("Maximum certificate chain length was exceeded.");
759
			code = "PathLengthExceeded";
759
			code = "PathLengthExceeded";
760
			break;
760
			break;
761
		case QCA::TLS::Expired:
761
		case TQCA::TLS::Expired:
762
			validityString = i18n("The certificate has expired.");
762
			validityString = i18n("The certificate has expired.");
763
			code = "Expired";
763
			code = "Expired";
764
			break;
764
			break;
765
		case QCA::TLS::Unknown:
765
		case TQCA::TLS::Unknown:
766
		default:
766
		default:
767
			validityString = i18n("An unknown error occurred trying to validate the certificate.");
767
			validityString = i18n("An unknown error occurred trying to validate the certificate.");
768
			code = "Unknown";
768
			code = "Unknown";
(-)tdenetwork/kopete/protocols/groupwise/gwaccount.h (-4 / +4 lines)
Lines 41-50 Link Here
41
class GroupWiseChatSession;
41
class GroupWiseChatSession;
42
class GroupWiseProtocol;
42
class GroupWiseProtocol;
43
class KNetworkConnector;
43
class KNetworkConnector;
44
namespace QCA {
44
namespace TQCA {
45
	class TLS;
45
	class TLS;
46
}
46
}
47
class QCATLSHandler;
47
class TQCATLSHandler;
48
class ClientStream;
48
class ClientStream;
49
class Client;
49
class Client;
50
class GWContactList;
50
class GWContactList;
Lines 328-335 Link Here
328
	KAction * m_actionJoinChatRoom;
328
	KAction * m_actionJoinChatRoom;
329
	// Network code
329
	// Network code
330
	KNetworkConnector * m_connector;
330
	KNetworkConnector * m_connector;
331
	QCA::TLS * m_QCATLS;
331
	TQCA::TLS * m_TQCATLS;
332
	QCATLSHandler *	m_tlsHandler;
332
	TQCATLSHandler *	m_tlsHandler;
333
	ClientStream * m_clientStream;
333
	ClientStream * m_clientStream;
334
	// Client, entry point of libgroupwise
334
	// Client, entry point of libgroupwise
335
	Client * m_client;
335
	Client * m_client;
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/gwclientstream.cpp (-2 / +2 lines)
Lines 116-123 Link Here
116
	Connector *conn;
116
	Connector *conn;
117
	ByteStream *bs;
117
	ByteStream *bs;
118
	TLSHandler *tlsHandler;
118
	TLSHandler *tlsHandler;
119
	QCA::TLS *tls;
119
	TQCA::TLS *tls;
120
// 	QCA::SASL *sasl;
120
// 	TQCA::SASL *sasl;
121
	SecureStream *ss;
121
	SecureStream *ss;
122
	CoreProtocol client;
122
	CoreProtocol client;
123
	//CoreProtocol srv;
123
	//CoreProtocol srv;
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qca/INSTALL (-1 / +1 lines)
Lines 1-4 Link Here
1
Installing QCA
1
Installing TQCA
2
--------------
2
--------------
3
3
4
Installation should be straightforward:
4
Installation should be straightforward:
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qca/README (-1 / +1 lines)
Lines 23-29 Link Here
23
And of course, you get a very simple crypto API for Qt, where you can
23
And of course, you get a very simple crypto API for Qt, where you can
24
do things like:
24
do things like:
25
25
26
  QString hash = QCA::SHA1::hashToString(blockOfData);
26
  QString hash = TQCA::SHA1::hashToString(blockOfData);
27
27
28
Have fun!
28
Have fun!
29
29
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qca/src/qca.cpp (-64 / +64 lines)
Lines 40-51 Link Here
40
#define PLUGIN_EXT "so"
40
#define PLUGIN_EXT "so"
41
#endif
41
#endif
42
42
43
using namespace QCA;
43
using namespace TQCA;
44
44
45
class ProviderItem
45
class ProviderItem
46
{
46
{
47
public:
47
public:
48
	QCAProvider *p;
48
	TQCAProvider *p;
49
	TQString fname;
49
	TQString fname;
50
50
51
	static ProviderItem *load(const TQString &fname)
51
	static ProviderItem *load(const TQString &fname)
Lines 60-67 Link Here
60
			delete lib;
60
			delete lib;
61
			return 0;
61
			return 0;
62
		}
62
		}
63
		QCAProvider *(*createProvider)() = (QCAProvider *(*)())s;
63
		TQCAProvider *(*createProvider)() = (TQCAProvider *(*)())s;
64
		QCAProvider *p = createProvider();
64
		TQCAProvider *p = createProvider();
65
		if(!p) {
65
		if(!p) {
66
			delete lib;
66
			delete lib;
67
			return 0;
67
			return 0;
Lines 71-77 Link Here
71
		return i;
71
		return i;
72
	}
72
	}
73
73
74
	static ProviderItem *fromClass(QCAProvider *p)
74
	static ProviderItem *fromClass(TQCAProvider *p)
75
	{
75
	{
76
		ProviderItem *i = new ProviderItem(0, p);
76
		ProviderItem *i = new ProviderItem(0, p);
77
		return i;
77
		return i;
Lines 95-101 Link Here
95
	TQLibrary *lib;
95
	TQLibrary *lib;
96
	bool init_done;
96
	bool init_done;
97
97
98
	ProviderItem(TQLibrary *_lib, QCAProvider *_p)
98
	ProviderItem(TQLibrary *_lib, TQCAProvider *_p)
99
	{
99
	{
100
		lib = _lib;
100
		lib = _lib;
101
		p = _p;
101
		p = _p;
Lines 142-148 Link Here
142
			ProviderItem *i = ProviderItem::load(fname);
142
			ProviderItem *i = ProviderItem::load(fname);
143
			if(!i)
143
			if(!i)
144
				continue;
144
				continue;
145
			if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) {
145
			if(i->p->qcaVersion() != TQCA_PLUGIN_VERSION) {
146
				delete i;
146
				delete i;
147
				continue;
147
				continue;
148
			}
148
			}
Lines 152-158 Link Here
152
	}
152
	}
153
}
153
}
154
154
155
static void plugin_addClass(QCAProvider *p)
155
static void plugin_addClass(TQCAProvider *p)
156
{
156
{
157
	ProviderItem *i = ProviderItem::fromClass(p);
157
	ProviderItem *i = ProviderItem::fromClass(p);
158
	providerList.prepend(i);
158
	providerList.prepend(i);
Lines 172-178 Link Here
172
	return caps;
172
	return caps;
173
}
173
}
174
174
175
TQString QCA::arrayToHex(const TQByteArray &a)
175
TQString TQCA::arrayToHex(const TQByteArray &a)
176
{
176
{
177
	TQString out;
177
	TQString out;
178
	for(int n = 0; n < (int)a.size(); ++n) {
178
	for(int n = 0; n < (int)a.size(); ++n) {
Lines 183-189 Link Here
183
	return out;
183
	return out;
184
}
184
}
185
185
186
TQByteArray QCA::hexToArray(const TQString &str)
186
TQByteArray TQCA::hexToArray(const TQString &str)
187
{
187
{
188
	TQByteArray out(str.length() / 2);
188
	TQByteArray out(str.length() / 2);
189
	int at = 0;
189
	int at = 0;
Lines 196-202 Link Here
196
	return out;
196
	return out;
197
}
197
}
198
198
199
void QCA::init()
199
void TQCA::init()
200
{
200
{
201
	if(qca_init)
201
	if(qca_init)
202
		return;
202
		return;
Lines 204-210 Link Here
204
	providerList.setAutoDelete(true);
204
	providerList.setAutoDelete(true);
205
}
205
}
206
206
207
bool QCA::isSupported(int capabilities)
207
bool TQCA::isSupported(int capabilities)
208
{
208
{
209
	init();
209
	init();
210
210
Lines 221-232 Link Here
221
	return false;
221
	return false;
222
}
222
}
223
223
224
void QCA::insertProvider(QCAProvider *p)
224
void TQCA::insertProvider(TQCAProvider *p)
225
{
225
{
226
	plugin_addClass(p);
226
	plugin_addClass(p);
227
}
227
}
228
228
229
void QCA::unloadAllPlugins()
229
void TQCA::unloadAllPlugins()
230
{
230
{
231
	plugin_unloadall();
231
	plugin_unloadall();
232
}
232
}
Lines 236-242 Link Here
236
	init();
236
	init();
237
237
238
	// this call will also trip a scan for new plugins if needed
238
	// this call will also trip a scan for new plugins if needed
239
	if(!QCA::isSupported(cap))
239
	if(!TQCA::isSupported(cap))
240
		return 0;
240
		return 0;
241
241
242
	TQPtrListIterator<ProviderItem> it(providerList);
242
	TQPtrListIterator<ProviderItem> it(providerList);
Lines 271-280 Link Here
271
		c->reset();
271
		c->reset();
272
	}
272
	}
273
273
274
	QCA_HashContext *c;
274
	TQCA_HashContext *c;
275
};
275
};
276
276
277
Hash::Hash(QCA_HashContext *c)
277
Hash::Hash(TQCA_HashContext *c)
278
{
278
{
279
	d = new Private;
279
	d = new Private;
280
	d->c = c;
280
	d->c = c;
Lines 340-353 Link Here
340
		err = false;
340
		err = false;
341
	}
341
	}
342
342
343
	QCA_CipherContext *c;
343
	TQCA_CipherContext *c;
344
	int dir;
344
	int dir;
345
	int mode;
345
	int mode;
346
	TQByteArray key, iv;
346
	TQByteArray key, iv;
347
	bool err;
347
	bool err;
348
};
348
};
349
349
350
Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
350
Cipher::Cipher(TQCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
351
{
351
{
352
	d = new Private;
352
	d = new Private;
353
	d->c = c;
353
	d->c = c;
Lines 447-453 Link Here
447
// SHA1
447
// SHA1
448
//----------------------------------------------------------------------------
448
//----------------------------------------------------------------------------
449
SHA1::SHA1()
449
SHA1::SHA1()
450
:Hash((QCA_HashContext *)getContext(CAP_SHA1))
450
:Hash((TQCA_HashContext *)getContext(CAP_SHA1))
451
{
451
{
452
}
452
}
453
453
Lines 456-462 Link Here
456
// SHA256
456
// SHA256
457
//----------------------------------------------------------------------------
457
//----------------------------------------------------------------------------
458
SHA256::SHA256()
458
SHA256::SHA256()
459
:Hash((QCA_HashContext *)getContext(CAP_SHA256))
459
:Hash((TQCA_HashContext *)getContext(CAP_SHA256))
460
{
460
{
461
}
461
}
462
462
Lines 465-471 Link Here
465
// MD5
465
// MD5
466
//----------------------------------------------------------------------------
466
//----------------------------------------------------------------------------
467
MD5::MD5()
467
MD5::MD5()
468
:Hash((QCA_HashContext *)getContext(CAP_MD5))
468
:Hash((TQCA_HashContext *)getContext(CAP_MD5))
469
{
469
{
470
}
470
}
471
471
Lines 474-480 Link Here
474
// BlowFish
474
// BlowFish
475
//----------------------------------------------------------------------------
475
//----------------------------------------------------------------------------
476
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
476
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
477
:Cipher((QCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
477
:Cipher((TQCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
478
{
478
{
479
}
479
}
480
480
Lines 483-489 Link Here
483
// TripleDES
483
// TripleDES
484
//----------------------------------------------------------------------------
484
//----------------------------------------------------------------------------
485
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
485
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
486
:Cipher((QCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
486
:Cipher((TQCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
487
{
487
{
488
}
488
}
489
489
Lines 492-498 Link Here
492
// AES128
492
// AES128
493
//----------------------------------------------------------------------------
493
//----------------------------------------------------------------------------
494
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
494
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
495
:Cipher((QCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
495
:Cipher((TQCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
496
{
496
{
497
}
497
}
498
498
Lines 501-507 Link Here
501
// AES256
501
// AES256
502
//----------------------------------------------------------------------------
502
//----------------------------------------------------------------------------
503
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
503
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
504
:Cipher((QCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
504
:Cipher((TQCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
505
{
505
{
506
}
506
}
507
507
Lines 522-534 Link Here
522
		delete c;
522
		delete c;
523
	}
523
	}
524
524
525
	QCA_RSAKeyContext *c;
525
	TQCA_RSAKeyContext *c;
526
};
526
};
527
527
528
RSAKey::RSAKey()
528
RSAKey::RSAKey()
529
{
529
{
530
	d = new Private;
530
	d = new Private;
531
	d->c = (QCA_RSAKeyContext *)getContext(CAP_RSA);
531
	d->c = (TQCA_RSAKeyContext *)getContext(CAP_RSA);
532
}
532
}
533
533
534
RSAKey::RSAKey(const RSAKey &from)
534
RSAKey::RSAKey(const RSAKey &from)
Lines 685-698 Link Here
685
		delete c;
685
		delete c;
686
	}
686
	}
687
687
688
	QCA_CertContext *c;
688
	TQCA_CertContext *c;
689
};
689
};
690
690
691
Cert::Cert()
691
Cert::Cert()
692
{
692
{
693
	d = new Private;
693
	d = new Private;
694
	// crash because this is returning 0
694
	// crash because this is returning 0
695
	d->c = (QCA_CertContext *)getContext(CAP_X509);
695
	d->c = (TQCA_CertContext *)getContext(CAP_X509);
696
}
696
}
697
697
698
Cert::Cert(const Cert &from)
698
Cert::Cert(const Cert &from)
Lines 716-722 Link Here
716
	delete d;
716
	delete d;
717
}
717
}
718
718
719
void Cert::fromContext(QCA_CertContext *ctx)
719
void Cert::fromContext(TQCA_CertContext *ctx)
720
{
720
{
721
	delete d->c;
721
	delete d->c;
722
	d->c = ctx;
722
	d->c = ctx;
Lines 750-767 Link Here
750
750
751
CertProperties Cert::subject() const
751
CertProperties Cert::subject() const
752
{
752
{
753
	TQValueList<QCA_CertProperty> list = d->c->subject();
753
	TQValueList<TQCA_CertProperty> list = d->c->subject();
754
	CertProperties props;
754
	CertProperties props;
755
	for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
755
	for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
756
		props[(*it).var] = (*it).val;
756
		props[(*it).var] = (*it).val;
757
	return props;
757
	return props;
758
}
758
}
759
759
760
CertProperties Cert::issuer() const
760
CertProperties Cert::issuer() const
761
{
761
{
762
	TQValueList<QCA_CertProperty> list = d->c->issuer();
762
	TQValueList<TQCA_CertProperty> list = d->c->issuer();
763
	CertProperties props;
763
	CertProperties props;
764
	for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
764
	for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
765
		props[(*it).var] = (*it).val;
765
		props[(*it).var] = (*it).val;
766
	return props;
766
	return props;
767
}
767
}
Lines 818-824 Link Here
818
public:
818
public:
819
	Private()
819
	Private()
820
	{
820
	{
821
		c = (QCA_TLSContext *)getContext(CAP_TLS);
821
		c = (TQCA_TLSContext *)getContext(CAP_TLS);
822
	}
822
	}
823
823
824
	~Private()
824
	~Private()
Lines 850-856 Link Here
850
	}
850
	}
851
851
852
	Cert cert;
852
	Cert cert;
853
	QCA_TLSContext *c;
853
	TQCA_TLSContext *c;
854
	TQByteArray in, out, to_net, from_net;
854
	TQByteArray in, out, to_net, from_net;
855
	int bytesEncoded;
855
	int bytesEncoded;
856
	bool tryMore;
856
	bool tryMore;
Lines 861-867 Link Here
861
861
862
	Cert ourCert;
862
	Cert ourCert;
863
	RSAKey ourKey;
863
	RSAKey ourKey;
864
	TQPtrList<QCA_CertContext> store;
864
	TQPtrList<TQCA_CertContext> store;
865
};
865
};
866
866
867
TLS::TLS(TQObject *parent)
867
TLS::TLS(TQObject *parent)
Lines 971-977 Link Here
971
int TLS::certificateValidityResult() const
971
int TLS::certificateValidityResult() const
972
{
972
{
973
	if(d->hostMismatch)
973
	if(d->hostMismatch)
974
		return QCA::TLS::HostMismatch;
974
		return TQCA::TLS::HostMismatch;
975
	else
975
	else
976
		return d->c->validityResult();
976
		return d->c->validityResult();
977
}
977
}
Lines 987-998 Link Here
987
		TQByteArray a;
987
		TQByteArray a;
988
		int r = d->c->shutdown(d->from_net, &a);
988
		int r = d->c->shutdown(d->from_net, &a);
989
		d->from_net.resize(0);
989
		d->from_net.resize(0);
990
		if(r == QCA_TLSContext::Error) {
990
		if(r == TQCA_TLSContext::Error) {
991
			reset();
991
			reset();
992
			error(ErrHandshake);
992
			error(ErrHandshake);
993
			return;
993
			return;
994
		}
994
		}
995
		if(r == QCA_TLSContext::Success) {
995
		if(r == TQCA_TLSContext::Success) {
996
			d->from_net = d->c->unprocessed().copy();
996
			d->from_net = d->c->unprocessed().copy();
997
			done = true;
997
			done = true;
998
		}
998
		}
Lines 1003-1017 Link Here
1003
			TQByteArray a;
1003
			TQByteArray a;
1004
			int r = d->c->handshake(d->from_net, &a);
1004
			int r = d->c->handshake(d->from_net, &a);
1005
			d->from_net.resize(0);
1005
			d->from_net.resize(0);
1006
			if(r == QCA_TLSContext::Error) {
1006
			if(r == TQCA_TLSContext::Error) {
1007
				reset();
1007
				reset();
1008
				error(ErrHandshake);
1008
				error(ErrHandshake);
1009
				return;
1009
				return;
1010
			}
1010
			}
1011
			d->appendArray(&d->to_net, a);
1011
			d->appendArray(&d->to_net, a);
1012
			if(r == QCA_TLSContext::Success) {
1012
			if(r == TQCA_TLSContext::Success) {
1013
				QCA_CertContext *cc = d->c->peerCertificate();
1013
				TQCA_CertContext *cc = d->c->peerCertificate();
1014
				if(cc && !d->host.isEmpty() && d->c->validityResult() == QCA::TLS::Valid) {
1014
				if(cc && !d->host.isEmpty() && d->c->validityResult() == TQCA::TLS::Valid) {
1015
					if(!cc->matchesAddress(d->host))
1015
					if(!cc->matchesAddress(d->host))
1016
						d->hostMismatch = true;
1016
						d->hostMismatch = true;
1017
				}
1017
				}
Lines 1102-1108 Link Here
1102
public:
1102
public:
1103
	Private()
1103
	Private()
1104
	{
1104
	{
1105
		c = (QCA_SASLContext *)getContext(CAP_SASL);
1105
		c = (TQCA_SASLContext *)getContext(CAP_SASL);
1106
	}
1106
	}
1107
1107
1108
	~Private()
1108
	~Private()
Lines 1122-1128 Link Here
1122
	int ext_ssf;
1122
	int ext_ssf;
1123
1123
1124
	bool tried;
1124
	bool tried;
1125
	QCA_SASLContext *c;
1125
	TQCA_SASLContext *c;
1126
	TQHostAddress localAddr, remoteAddr;
1126
	TQHostAddress localAddr, remoteAddr;
1127
	int localPort, remotePort;
1127
	int localPort, remotePort;
1128
	TQByteArray stepData;
1128
	TQByteArray stepData;
Lines 1246-1252 Link Here
1246
1246
1247
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
1247
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
1248
{
1248
{
1249
	QCA_SASLHostPort la, ra;
1249
	TQCA_SASLHostPort la, ra;
1250
	if(d->localPort != -1) {
1250
	if(d->localPort != -1) {
1251
		la.addr = d->localAddr;
1251
		la.addr = d->localAddr;
1252
		la.port = d->localPort;
1252
		la.port = d->localPort;
Lines 1271-1277 Link Here
1271
1271
1272
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
1272
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
1273
{
1273
{
1274
	QCA_SASLHostPort la, ra;
1274
	TQCA_SASLHostPort la, ra;
1275
	if(d->localPort != -1) {
1275
	if(d->localPort != -1) {
1276
		la.addr = d->localAddr;
1276
		la.addr = d->localAddr;
1277
		la.port = d->localPort;
1277
		la.port = d->localPort;
Lines 1306-1316 Link Here
1306
1306
1307
void SASL::handleServerFirstStep(int r)
1307
void SASL::handleServerFirstStep(int r)
1308
{
1308
{
1309
	if(r == QCA_SASLContext::Success)
1309
	if(r == TQCA_SASLContext::Success)
1310
		authenticated();
1310
		authenticated();
1311
	else if(r == QCA_SASLContext::Continue)
1311
	else if(r == TQCA_SASLContext::Continue)
1312
		nextStep(d->c->result());
1312
		nextStep(d->c->result());
1313
	else if(r == QCA_SASLContext::AuthCheck)
1313
	else if(r == TQCA_SASLContext::AuthCheck)
1314
		tryAgain();
1314
		tryAgain();
1315
	else
1315
	else
1316
		error(ErrAuth);
1316
		error(ErrAuth);
Lines 1365-1380 Link Here
1365
			r = d->c->tryAgain();
1365
			r = d->c->tryAgain();
1366
		}
1366
		}
1367
1367
1368
		if(r == QCA_SASLContext::Error) {
1368
		if(r == TQCA_SASLContext::Error) {
1369
			error(ErrAuth);
1369
			error(ErrAuth);
1370
			return;
1370
			return;
1371
		}
1371
		}
1372
		else if(r == QCA_SASLContext::Continue) {
1372
		else if(r == TQCA_SASLContext::Continue) {
1373
			d->tried = false;
1373
			d->tried = false;
1374
			nextStep(d->c->result());
1374
			nextStep(d->c->result());
1375
			return;
1375
			return;
1376
		}
1376
		}
1377
		else if(r == QCA_SASLContext::AuthCheck) {
1377
		else if(r == TQCA_SASLContext::AuthCheck) {
1378
			authCheck(d->c->username(), d->c->authzid());
1378
			authCheck(d->c->username(), d->c->authzid());
1379
			return;
1379
			return;
1380
		}
1380
		}
Lines 1388-1400 Link Here
1388
			else
1388
			else
1389
				r = d->c->tryAgain();
1389
				r = d->c->tryAgain();
1390
1390
1391
			if(r == QCA_SASLContext::Error) {
1391
			if(r == TQCA_SASLContext::Error) {
1392
				error(ErrAuth);
1392
				error(ErrAuth);
1393
				return;
1393
				return;
1394
			}
1394
			}
1395
			else if(r == QCA_SASLContext::NeedParams) {
1395
			else if(r == TQCA_SASLContext::NeedParams) {
1396
				//d->tried = false;
1396
				//d->tried = false;
1397
				QCA_SASLNeedParams np = d->c->clientParamsNeeded();
1397
				TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
1398
				needParams(np.user, np.authzid, np.pass, np.realm);
1398
				needParams(np.user, np.authzid, np.pass, np.realm);
1399
				return;
1399
				return;
1400
			}
1400
			}
Lines 1414-1440 Link Here
1414
			else
1414
			else
1415
				r = d->c->tryAgain();
1415
				r = d->c->tryAgain();
1416
1416
1417
			if(r == QCA_SASLContext::Error) {
1417
			if(r == TQCA_SASLContext::Error) {
1418
				error(ErrAuth);
1418
				error(ErrAuth);
1419
				return;
1419
				return;
1420
			}
1420
			}
1421
			else if(r == QCA_SASLContext::NeedParams) {
1421
			else if(r == TQCA_SASLContext::NeedParams) {
1422
				//d->tried = false;
1422
				//d->tried = false;
1423
				QCA_SASLNeedParams np = d->c->clientParamsNeeded();
1423
				TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
1424
				needParams(np.user, np.authzid, np.pass, np.realm);
1424
				needParams(np.user, np.authzid, np.pass, np.realm);
1425
				return;
1425
				return;
1426
			}
1426
			}
1427
			d->tried = false;
1427
			d->tried = false;
1428
			//else if(r == QCA_SASLContext::Continue) {
1428
			//else if(r == TQCA_SASLContext::Continue) {
1429
				nextStep(d->c->result());
1429
				nextStep(d->c->result());
1430
			//	return;
1430
			//	return;
1431
			//}
1431
			//}
1432
		}
1432
		}
1433
	}
1433
	}
1434
1434
1435
	if(r == QCA_SASLContext::Success)
1435
	if(r == TQCA_SASLContext::Success)
1436
		authenticated();
1436
		authenticated();
1437
	else if(r == QCA_SASLContext::Error)
1437
	else if(r == TQCA_SASLContext::Error)
1438
		error(ErrAuth);
1438
		error(ErrAuth);
1439
}
1439
}
1440
1440
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qca/src/qca.h (-43 / +43 lines)
Lines 18-25 Link Here
18
 *
18
 *
19
 */
19
 */
20
20
21
#ifndef QCA_H
21
#ifndef TQCA_H
22
#define QCA_H
22
#define TQCA_H
23
23
24
#include<tqstring.h>
24
#include<tqstring.h>
25
#include<tqcstring.h>
25
#include<tqcstring.h>
Lines 29-66 Link Here
29
#include<tqobject.h>
29
#include<tqobject.h>
30
30
31
#ifdef Q_OS_WIN32
31
#ifdef Q_OS_WIN32
32
#  ifndef QCA_STATIC
32
#  ifndef TQCA_STATIC
33
#    ifdef QCA_MAKEDLL
33
#    ifdef TQCA_MAKEDLL
34
#      define QCA_EXPORT __declspec(dllexport)
34
#      define TQCA_EXPORT __declspec(dllexport)
35
#    else
35
#    else
36
#      define QCA_EXPORT __declspec(dllimport)
36
#      define TQCA_EXPORT __declspec(dllimport)
37
#    endif
37
#    endif
38
#  endif
38
#  endif
39
#endif
39
#endif
40
#ifndef QCA_EXPORT
40
#ifndef TQCA_EXPORT
41
#define QCA_EXPORT
41
#define TQCA_EXPORT
42
#endif
42
#endif
43
43
44
#ifdef Q_OS_WIN32
44
#ifdef Q_OS_WIN32
45
#  ifdef QCA_PLUGIN_DLL
45
#  ifdef TQCA_PLUGIN_DLL
46
#    define QCA_PLUGIN_EXPORT extern "C" __declspec(dllexport)
46
#    define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllexport)
47
#  else
47
#  else
48
#    define QCA_PLUGIN_EXPORT extern "C" __declspec(dllimport)
48
#    define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllimport)
49
#  endif
49
#  endif
50
#endif
50
#endif
51
#ifndef QCA_PLUGIN_EXPORT
51
#ifndef TQCA_PLUGIN_EXPORT
52
#define QCA_PLUGIN_EXPORT extern "C"
52
#define TQCA_PLUGIN_EXPORT extern "C"
53
#endif
53
#endif
54
54
55
class TQHostAddress;
55
class TQHostAddress;
56
class TQStringList;
56
class TQStringList;
57
57
58
class QCAProvider;
58
class TQCAProvider;
59
class QCA_HashContext;
59
class TQCA_HashContext;
60
class QCA_CipherContext;
60
class TQCA_CipherContext;
61
class QCA_CertContext;
61
class TQCA_CertContext;
62
62
63
namespace QCA
63
namespace TQCA
64
{
64
{
65
	enum {
65
	enum {
66
		CAP_SHA1      = 0x0001,
66
		CAP_SHA1      = 0x0001,
Lines 86-100 Link Here
86
		Decrypt = 0x0002
86
		Decrypt = 0x0002
87
	};
87
	};
88
88
89
	QCA_EXPORT void init();
89
	TQCA_EXPORT void init();
90
	QCA_EXPORT bool isSupported(int capabilities);
90
	TQCA_EXPORT bool isSupported(int capabilities);
91
	QCA_EXPORT void insertProvider(QCAProvider *);
91
	TQCA_EXPORT void insertProvider(TQCAProvider *);
92
	QCA_EXPORT void unloadAllPlugins();
92
	TQCA_EXPORT void unloadAllPlugins();
93
93
94
	QCA_EXPORT TQString arrayToHex(const TQByteArray &);
94
	TQCA_EXPORT TQString arrayToHex(const TQByteArray &);
95
	QCA_EXPORT TQByteArray hexToArray(const TQString &);
95
	TQCA_EXPORT TQByteArray hexToArray(const TQString &);
96
96
97
	class QCA_EXPORT Hash
97
	class TQCA_EXPORT Hash
98
	{
98
	{
99
	public:
99
	public:
100
		Hash(const Hash &);
100
		Hash(const Hash &);
Lines 106-112 Link Here
106
		TQByteArray final();
106
		TQByteArray final();
107
107
108
	protected:
108
	protected:
109
		Hash(QCA_HashContext *);
109
		Hash(TQCA_HashContext *);
110
110
111
	private:
111
	private:
112
		class Private;
112
		class Private;
Lines 114-120 Link Here
114
	};
114
	};
115
115
116
	template <class T>
116
	template <class T>
117
	class QCA_EXPORT HashStatic
117
	class TQCA_EXPORT HashStatic
118
	{
118
	{
119
	public:
119
	public:
120
		HashStatic<T>() {}
120
		HashStatic<T>() {}
Lines 144-150 Link Here
144
		}
144
		}
145
	};
145
	};
146
146
147
	class QCA_EXPORT Cipher
147
	class TQCA_EXPORT Cipher
148
	{
148
	{
149
	public:
149
	public:
150
		Cipher(const Cipher &);
150
		Cipher(const Cipher &);
Lines 158-164 Link Here
158
		TQByteArray final(bool *ok=0);
158
		TQByteArray final(bool *ok=0);
159
159
160
	protected:
160
	protected:
161
		Cipher(QCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad);
161
		Cipher(TQCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad);
162
162
163
	private:
163
	private:
164
		class Private;
164
		class Private;
Lines 166-172 Link Here
166
	};
166
	};
167
167
168
	template <class T>
168
	template <class T>
169
	class QCA_EXPORT CipherStatic
169
	class TQCA_EXPORT CipherStatic
170
	{
170
	{
171
	public:
171
	public:
172
		CipherStatic<T>() {}
172
		CipherStatic<T>() {}
Lines 184-233 Link Here
184
		}
184
		}
185
	};
185
	};
186
186
187
	class QCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1>
187
	class TQCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1>
188
	{
188
	{
189
	public:
189
	public:
190
		SHA1();
190
		SHA1();
191
	};
191
	};
192
192
193
	class QCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256>
193
	class TQCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256>
194
	{
194
	{
195
	public:
195
	public:
196
		SHA256();
196
		SHA256();
197
	};
197
	};
198
198
199
	class QCA_EXPORT MD5 : public Hash, public HashStatic<MD5>
199
	class TQCA_EXPORT MD5 : public Hash, public HashStatic<MD5>
200
	{
200
	{
201
	public:
201
	public:
202
		MD5();
202
		MD5();
203
	};
203
	};
204
204
205
	class QCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish>
205
	class TQCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish>
206
	{
206
	{
207
	public:
207
	public:
208
		BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
208
		BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
209
	};
209
	};
210
210
211
	class QCA_EXPORT TripleDES : public Cipher, public CipherStatic<TripleDES>
211
	class TQCA_EXPORT TripleDES : public Cipher, public CipherStatic<TripleDES>
212
	{
212
	{
213
	public:
213
	public:
214
		TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
214
		TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
215
	};
215
	};
216
216
217
	class QCA_EXPORT AES128 : public Cipher, public CipherStatic<AES128>
217
	class TQCA_EXPORT AES128 : public Cipher, public CipherStatic<AES128>
218
	{
218
	{
219
	public:
219
	public:
220
		AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
220
		AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
221
	};
221
	};
222
222
223
	class QCA_EXPORT AES256 : public Cipher, public CipherStatic<AES256>
223
	class TQCA_EXPORT AES256 : public Cipher, public CipherStatic<AES256>
224
	{
224
	{
225
	public:
225
	public:
226
		AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
226
		AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
227
	};
227
	};
228
228
229
	class RSA;
229
	class RSA;
230
	class QCA_EXPORT RSAKey
230
	class TQCA_EXPORT RSAKey
231
	{
231
	{
232
	public:
232
	public:
233
		RSAKey();
233
		RSAKey();
Lines 259-265 Link Here
259
		bool generate(unsigned int bits);
259
		bool generate(unsigned int bits);
260
	};
260
	};
261
261
262
	class QCA_EXPORT RSA
262
	class TQCA_EXPORT RSA
263
	{
263
	{
264
	public:
264
	public:
265
		RSA();
265
		RSA();
Lines 278-284 Link Here
278
	};
278
	};
279
279
280
	typedef TQMap<TQString, TQString> CertProperties;
280
	typedef TQMap<TQString, TQString> CertProperties;
281
	class QCA_EXPORT Cert
281
	class TQCA_EXPORT Cert
282
	{
282
	{
283
	public:
283
	public:
284
		Cert();
284
		Cert();
Lines 308-317 Link Here
308
		Private *d;
308
		Private *d;
309
309
310
		friend class TLS;
310
		friend class TLS;
311
		void fromContext(QCA_CertContext *);
311
		void fromContext(TQCA_CertContext *);
312
	};
312
	};
313
313
314
	class QCA_EXPORT TLS : public TQObject
314
	class TQCA_EXPORT TLS : public TQObject
315
	{
315
	{
316
		Q_OBJECT
316
		Q_OBJECT
317
  
317
  
Lines 373-379 Link Here
373
		Private *d;
373
		Private *d;
374
	};
374
	};
375
375
376
	class QCA_EXPORT SASL : public TQObject
376
	class TQCA_EXPORT SASL : public TQObject
377
	{
377
	{
378
		Q_OBJECT
378
		Q_OBJECT
379
  
379
  
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qca/src/qcaprovider.h (-33 / +33 lines)
Lines 1-5 Link Here
1
/*
1
/*
2
 * qcaprovider.h - QCA Plugin API
2
 * qcaprovider.h - TQCA Plugin API
3
 * Copyright (C) 2003  Justin Karneges
3
 * Copyright (C) 2003  Justin Karneges
4
 *
4
 *
5
 * This library is free software; you can redistribute it and/or
5
 * This library is free software; you can redistribute it and/or
Lines 18-25 Link Here
18
 *
18
 *
19
 */
19
 */
20
20
21
#ifndef QCAPROVIDER_H
21
#ifndef TQCAPROVIDER_H
22
#define QCAPROVIDER_H
22
#define TQCAPROVIDER_H
23
23
24
#include<tqglobal.h>
24
#include<tqglobal.h>
25
#include<tqstring.h>
25
#include<tqstring.h>
Lines 28-40 Link Here
28
#include<tqhostaddress.h>
28
#include<tqhostaddress.h>
29
#include"qca.h"
29
#include"qca.h"
30
30
31
#define QCA_PLUGIN_VERSION 1
31
#define TQCA_PLUGIN_VERSION 1
32
32
33
class QCAProvider
33
class TQCAProvider
34
{
34
{
35
public:
35
public:
36
	QCAProvider() {}
36
	TQCAProvider() {}
37
	virtual ~QCAProvider() {}
37
	virtual ~TQCAProvider() {}
38
38
39
	virtual void init()=0;
39
	virtual void init()=0;
40
	virtual int qcaVersion() const=0;
40
	virtual int qcaVersion() const=0;
Lines 42-64 Link Here
42
	virtual void *context(int cap)=0;
42
	virtual void *context(int cap)=0;
43
};
43
};
44
44
45
class QCA_HashContext
45
class TQCA_HashContext
46
{
46
{
47
public:
47
public:
48
	virtual ~QCA_HashContext() {}
48
	virtual ~TQCA_HashContext() {}
49
49
50
	virtual QCA_HashContext *clone()=0;
50
	virtual TQCA_HashContext *clone()=0;
51
	virtual void reset()=0;
51
	virtual void reset()=0;
52
	virtual void update(const char *in, unsigned int len)=0;
52
	virtual void update(const char *in, unsigned int len)=0;
53
	virtual void final(TQByteArray *out)=0;
53
	virtual void final(TQByteArray *out)=0;
54
};
54
};
55
55
56
class QCA_CipherContext
56
class TQCA_CipherContext
57
{
57
{
58
public:
58
public:
59
	virtual ~QCA_CipherContext() {}
59
	virtual ~TQCA_CipherContext() {}
60
60
61
	virtual QCA_CipherContext *clone()=0;
61
	virtual TQCA_CipherContext *clone()=0;
62
	virtual int keySize()=0;
62
	virtual int keySize()=0;
63
	virtual int blockSize()=0;
63
	virtual int blockSize()=0;
64
	virtual bool generateKey(char *out, int keysize=-1)=0;
64
	virtual bool generateKey(char *out, int keysize=-1)=0;
Lines 69-80 Link Here
69
	virtual bool final(TQByteArray *out)=0;
69
	virtual bool final(TQByteArray *out)=0;
70
};
70
};
71
71
72
class QCA_RSAKeyContext
72
class TQCA_RSAKeyContext
73
{
73
{
74
public:
74
public:
75
	virtual ~QCA_RSAKeyContext() {}
75
	virtual ~TQCA_RSAKeyContext() {}
76
76
77
	virtual QCA_RSAKeyContext *clone() const=0;
77
	virtual TQCA_RSAKeyContext *clone() const=0;
78
	virtual bool isNull() const=0;
78
	virtual bool isNull() const=0;
79
	virtual bool havePublic() const=0;
79
	virtual bool havePublic() const=0;
80
	virtual bool havePrivate() const=0;
80
	virtual bool havePrivate() const=0;
Lines 89-106 Link Here
89
	virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
89
	virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
90
};
90
};
91
91
92
struct QCA_CertProperty
92
struct TQCA_CertProperty
93
{
93
{
94
	TQString var;
94
	TQString var;
95
	TQString val;
95
	TQString val;
96
};
96
};
97
97
98
class QCA_CertContext
98
class TQCA_CertContext
99
{
99
{
100
public:
100
public:
101
	virtual ~QCA_CertContext() {}
101
	virtual ~TQCA_CertContext() {}
102
102
103
	virtual QCA_CertContext *clone() const=0;
103
	virtual TQCA_CertContext *clone() const=0;
104
	virtual bool isNull() const=0;
104
	virtual bool isNull() const=0;
105
	virtual bool createFromDER(const char *in, unsigned int len)=0;
105
	virtual bool createFromDER(const char *in, unsigned int len)=0;
106
	virtual bool createFromPEM(const char *in, unsigned int len)=0;
106
	virtual bool createFromPEM(const char *in, unsigned int len)=0;
Lines 110-131 Link Here
110
	virtual TQString serialNumber() const=0;
110
	virtual TQString serialNumber() const=0;
111
	virtual TQString subjectString() const=0;
111
	virtual TQString subjectString() const=0;
112
	virtual TQString issuerString() const=0;
112
	virtual TQString issuerString() const=0;
113
	virtual TQValueList<QCA_CertProperty> subject() const=0;
113
	virtual TQValueList<TQCA_CertProperty> subject() const=0;
114
	virtual TQValueList<QCA_CertProperty> issuer() const=0;
114
	virtual TQValueList<TQCA_CertProperty> issuer() const=0;
115
	virtual TQDateTime notBefore() const=0;
115
	virtual TQDateTime notBefore() const=0;
116
	virtual TQDateTime notAfter() const=0;
116
	virtual TQDateTime notAfter() const=0;
117
	virtual bool matchesAddress(const TQString &realHost) const=0;
117
	virtual bool matchesAddress(const TQString &realHost) const=0;
118
};
118
};
119
119
120
class QCA_TLSContext
120
class TQCA_TLSContext
121
{
121
{
122
public:
122
public:
123
	enum Result { Success, Error, Continue };
123
	enum Result { Success, Error, Continue };
124
	virtual ~QCA_TLSContext() {}
124
	virtual ~TQCA_TLSContext() {}
125
125
126
	virtual void reset()=0;
126
	virtual void reset()=0;
127
	virtual bool startClient(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
127
	virtual bool startClient(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
128
	virtual bool startServer(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
128
	virtual bool startServer(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
129
129
130
	virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
130
	virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
131
	virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
131
	virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
Lines 134-163 Link Here
134
	virtual bool eof() const=0;
134
	virtual bool eof() const=0;
135
	virtual TQByteArray unprocessed()=0;
135
	virtual TQByteArray unprocessed()=0;
136
136
137
	virtual QCA_CertContext *peerCertificate() const=0;
137
	virtual TQCA_CertContext *peerCertificate() const=0;
138
	virtual int validityResult() const=0;
138
	virtual int validityResult() const=0;
139
};
139
};
140
140
141
struct QCA_SASLHostPort
141
struct TQCA_SASLHostPort
142
{
142
{
143
	TQHostAddress addr;
143
	TQHostAddress addr;
144
	TQ_UINT16 port;
144
	TQ_UINT16 port;
145
};
145
};
146
146
147
struct QCA_SASLNeedParams
147
struct TQCA_SASLNeedParams
148
{
148
{
149
	bool user, authzid, pass, realm;
149
	bool user, authzid, pass, realm;
150
};
150
};
151
151
152
class QCA_SASLContext
152
class TQCA_SASLContext
153
{
153
{
154
public:
154
public:
155
	enum Result { Success, Error, NeedParams, AuthCheck, Continue };
155
	enum Result { Success, Error, NeedParams, AuthCheck, Continue };
156
	virtual ~QCA_SASLContext() {}
156
	virtual ~TQCA_SASLContext() {}
157
157
158
	// common
158
	// common
159
	virtual void reset()=0;
159
	virtual void reset()=0;
160
	virtual void setCoreProps(const TQString &service, const TQString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0;
160
	virtual void setCoreProps(const TQString &service, const TQString &host, TQCA_SASLHostPort *local, TQCA_SASLHostPort *remote)=0;
161
	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;
161
	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;
162
	virtual int security() const=0;
162
	virtual int security() const=0;
163
	virtual int errorCond() const=0;
163
	virtual int errorCond() const=0;
Lines 169-175 Link Here
169
	virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
169
	virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
170
170
171
	// get / set params
171
	// get / set params
172
	virtual QCA_SASLNeedParams clientParamsNeeded() const=0;
172
	virtual TQCA_SASLNeedParams clientParamsNeeded() const=0;
173
	virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
173
	virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
174
	virtual TQString username() const=0;
174
	virtual TQString username() const=0;
175
	virtual TQString authzid() const=0;
175
	virtual TQString authzid() const=0;
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qcatlshandler.cpp (-16 / +16 lines)
Lines 23-36 Link Here
23
23
24
#include "qcatlshandler.h"
24
#include "qcatlshandler.h"
25
25
26
class QCATLSHandler::Private
26
class TQCATLSHandler::Private
27
{
27
{
28
public:
28
public:
29
	QCA::TLS *tls;
29
	TQCA::TLS *tls;
30
	int state, err;
30
	int state, err;
31
};
31
};
32
32
33
QCATLSHandler::QCATLSHandler(QCA::TLS *parent)
33
TQCATLSHandler::TQCATLSHandler(TQCA::TLS *parent)
34
:TLSHandler(parent)
34
:TLSHandler(parent)
35
{
35
{
36
	d = new Private;
36
	d = new Private;
Lines 44-71 Link Here
44
	d->err = -1;
44
	d->err = -1;
45
}
45
}
46
46
47
QCATLSHandler::~QCATLSHandler()
47
TQCATLSHandler::~TQCATLSHandler()
48
{
48
{
49
	delete d;
49
	delete d;
50
}
50
}
51
51
52
QCA::TLS *QCATLSHandler::tls() const
52
TQCA::TLS *TQCATLSHandler::tls() const
53
{
53
{
54
	return d->tls;
54
	return d->tls;
55
}
55
}
56
56
57
int QCATLSHandler::tlsError() const
57
int TQCATLSHandler::tlsError() const
58
{
58
{
59
	return d->err;
59
	return d->err;
60
}
60
}
61
61
62
void QCATLSHandler::reset()
62
void TQCATLSHandler::reset()
63
{
63
{
64
	d->tls->reset();
64
	d->tls->reset();
65
	d->state = 0;
65
	d->state = 0;
66
}
66
}
67
67
68
void QCATLSHandler::startClient(const TQString &host)
68
void TQCATLSHandler::startClient(const TQString &host)
69
{
69
{
70
	d->state = 0;
70
	d->state = 0;
71
	d->err = -1;
71
	d->err = -1;
Lines 73-89 Link Here
73
		TQTimer::singleShot(0, this, TQT_SIGNAL(fail()));
73
		TQTimer::singleShot(0, this, TQT_SIGNAL(fail()));
74
}
74
}
75
75
76
void QCATLSHandler::write(const TQByteArray &a)
76
void TQCATLSHandler::write(const TQByteArray &a)
77
{
77
{
78
	d->tls->write(a);
78
	d->tls->write(a);
79
}
79
}
80
80
81
void QCATLSHandler::writeIncoming(const TQByteArray &a)
81
void TQCATLSHandler::writeIncoming(const TQByteArray &a)
82
{
82
{
83
	d->tls->writeIncoming(a);
83
	d->tls->writeIncoming(a);
84
}
84
}
85
85
86
void QCATLSHandler::continueAfterHandshake()
86
void TQCATLSHandler::continueAfterHandshake()
87
{
87
{
88
	if(d->state == 2) {
88
	if(d->state == 2) {
89
		success();
89
		success();
Lines 91-118 Link Here
91
	}
91
	}
92
}
92
}
93
93
94
void QCATLSHandler::tls_handshaken()
94
void TQCATLSHandler::tls_handshaken()
95
{
95
{
96
	d->state = 2;
96
	d->state = 2;
97
	tlsHandshaken();
97
	tlsHandshaken();
98
}
98
}
99
99
100
void QCATLSHandler::tls_readyRead()
100
void TQCATLSHandler::tls_readyRead()
101
{
101
{
102
	readyRead(d->tls->read());
102
	readyRead(d->tls->read());
103
}
103
}
104
104
105
void QCATLSHandler::tls_readyReadOutgoing(int plainBytes)
105
void TQCATLSHandler::tls_readyReadOutgoing(int plainBytes)
106
{
106
{
107
	readyReadOutgoing(d->tls->readOutgoing(), plainBytes);
107
	readyReadOutgoing(d->tls->readOutgoing(), plainBytes);
108
}
108
}
109
109
110
void QCATLSHandler::tls_closed()
110
void TQCATLSHandler::tls_closed()
111
{
111
{
112
	closed();
112
	closed();
113
}
113
}
114
114
115
void QCATLSHandler::tls_error(int x)
115
void TQCATLSHandler::tls_error(int x)
116
{
116
{
117
	d->err = x;
117
	d->err = x;
118
	d->state = 0;
118
	d->state = 0;
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/qcatlshandler.h (-7 / +7 lines)
Lines 17-39 Link Here
17
    *************************************************************************
17
    *************************************************************************
18
*/
18
*/
19
  
19
  
20
#ifndef GWQCATLSHANDLER_H
20
#ifndef GWTQCATLSHANDLER_H
21
#define GWQCATLSHANDLER_H
21
#define GWTQCATLSHANDLER_H
22
22
23
//#include <tqtimer.h>
23
//#include <tqtimer.h>
24
#include "tlshandler.h"
24
#include "tlshandler.h"
25
25
26
class QCA::TLS;
26
class TQCA::TLS;
27
27
28
class QCATLSHandler : public TLSHandler
28
class TQCATLSHandler : public TLSHandler
29
{
29
{
30
	Q_OBJECT
30
	Q_OBJECT
31
  
31
  
32
public:
32
public:
33
	QCATLSHandler(QCA::TLS *parent);
33
	TQCATLSHandler(TQCA::TLS *parent);
34
	~QCATLSHandler();
34
	~TQCATLSHandler();
35
35
36
	QCA::TLS *tls() const;
36
	TQCA::TLS *tls() const;
37
	int tlsError() const;
37
	int tlsError() const;
38
38
39
	void reset();
39
	void reset();
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/securestream.cpp (-7 / +7 lines)
Lines 22-28 Link Here
22
  Note: SecureStream depends on the underlying security layers to signal
22
  Note: SecureStream depends on the underlying security layers to signal
23
    plain-to-encrypted results immediately (as opposed to waiting for the
23
    plain-to-encrypted results immediately (as opposed to waiting for the
24
    event loop) so that the user cannot add/remove security layers during
24
    event loop) so that the user cannot add/remove security layers during
25
    this conversion moment.  QCA::TLS and QCA::SASL behave as expected,
25
    this conversion moment.  TQCA::TLS and TQCA::SASL behave as expected,
26
    but future layers might not.
26
    but future layers might not.
27
*/
27
*/
28
28
Lines 86-92 Link Here
86
// SecureStream
86
// SecureStream
87
//----------------------------------------------------------------------------
87
//----------------------------------------------------------------------------
88
88
89
SecureLayer::SecureLayer(QCA::TLS *t)
89
SecureLayer::SecureLayer(TQCA::TLS *t)
90
{
90
{
91
	type = TLS;
91
	type = TLS;
92
	p.tls = t;
92
	p.tls = t;
Lines 98-104 Link Here
98
	connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
98
	connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
99
}
99
}
100
100
101
SecureLayer::SecureLayer(QCA::SASL *s)
101
SecureLayer::SecureLayer(TQCA::SASL *s)
102
{
102
{
103
	type = SASL;
103
	type = SASL;
104
	p.sasl = s;
104
	p.sasl = s;
Lines 329-335 Link Here
329
	return (d->pending - x);
329
	return (d->pending - x);
330
}
330
}
331
331
332
void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &spare)
332
void SecureStream::startTLSClient(TQCA::TLS *t, const TQByteArray &spare)
333
{
333
{
334
	if(!d->active || d->topInProgress || d->haveTLS())
334
	if(!d->active || d->topInProgress || d->haveTLS())
335
		return;
335
		return;
Lines 343-349 Link Here
343
	insertData(spare);
343
	insertData(spare);
344
}
344
}
345
345
346
void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &spare)
346
void SecureStream::startTLSServer(TQCA::TLS *t, const TQByteArray &spare)
347
{
347
{
348
	if(!d->active || d->topInProgress || d->haveTLS())
348
	if(!d->active || d->topInProgress || d->haveTLS())
349
		return;
349
		return;
Lines 357-363 Link Here
357
	insertData(spare);
357
	insertData(spare);
358
}
358
}
359
359
360
void SecureStream::setLayerSASL(QCA::SASL *sasl, const TQByteArray &spare)
360
void SecureStream::setLayerSASL(TQCA::SASL *sasl, const TQByteArray &spare)
361
{
361
{
362
	if(!d->active || d->topInProgress || d->haveSASL())
362
	if(!d->active || d->topInProgress || d->haveSASL())
363
		return;
363
		return;
Lines 382-388 Link Here
382
	d->layers.append(s);
382
	d->layers.append(s);
383
	d->topInProgress = true;
383
	d->topInProgress = true;
384
384
385
	// unlike QCA::TLS, TLSHandler has no return value
385
	// unlike TQCA::TLS, TLSHandler has no return value
386
	s->p.tlsHandler->startClient(server);
386
	s->p.tlsHandler->startClient(server);
387
387
388
	insertData(spare);
388
	insertData(spare);
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/securestream.h (-7 / +7 lines)
Lines 40-48 Link Here
40
	SecureStream(ByteStream *s);
40
	SecureStream(ByteStream *s);
41
	~SecureStream();
41
	~SecureStream();
42
42
43
	void startTLSClient(QCA::TLS *t, const TQByteArray &spare=TQByteArray());
43
	void startTLSClient(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
44
	void startTLSServer(QCA::TLS *t, const TQByteArray &spare=TQByteArray());
44
	void startTLSServer(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
45
	void setLayerSASL(QCA::SASL *s, const TQByteArray &spare=TQByteArray());
45
	void setLayerSASL(TQCA::SASL *s, const TQByteArray &spare=TQByteArray());
46
#ifdef USE_TLSHANDLER
46
#ifdef USE_TLSHANDLER
47
	void startTLSClient(TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray());
47
	void startTLSClient(TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray());
48
#endif
48
#endif
Lines 106-113 Link Here
106
	Q_OBJECT
106
	Q_OBJECT
107
  
107
  
108
public:
108
public:
109
	SecureLayer(QCA::TLS *t);
109
	SecureLayer(TQCA::TLS *t);
110
	SecureLayer(QCA::SASL *s);
110
	SecureLayer(TQCA::SASL *s);
111
#ifdef USE_TLSHANDLER
111
#ifdef USE_TLSHANDLER
112
	SecureLayer(TLSHandler *t);
112
	SecureLayer(TLSHandler *t);
113
#endif
113
#endif
Lines 119-126 Link Here
119
	enum { TLS, SASL, TLSH };
119
	enum { TLS, SASL, TLSH };
120
	int type;
120
	int type;
121
	union {
121
	union {
122
		QCA::TLS *tls;
122
		TQCA::TLS *tls;
123
		QCA::SASL *sasl;
123
		TQCA::SASL *sasl;
124
#ifdef USE_TLSHANDLER
124
#ifdef USE_TLSHANDLER
125
		TLSHandler *tlsHandler;
125
		TLSHandler *tlsHandler;
126
#endif
126
#endif
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/tests/clientstream_test.cpp (-4 / +4 lines)
Lines 7-15 Link Here
7
	//myConnector->setOptHostPort( "localhost", 8300 );
7
	//myConnector->setOptHostPort( "localhost", 8300 );
8
	myConnector->setOptHostPort( "reiser.suse.de", 8300 );
8
	myConnector->setOptHostPort( "reiser.suse.de", 8300 );
9
	myConnector->setOptSSL( true );
9
	myConnector->setOptSSL( true );
10
	Q_ASSERT( QCA::isSupported(QCA::CAP_TLS) );
10
	Q_ASSERT( TQCA::isSupported(TQCA::CAP_TLS) );
11
	myTLS = new QCA::TLS;
11
	myTLS = new TQCA::TLS;
12
	myTLSHandler = new QCATLSHandler( myTLS );
12
	myTLSHandler = new TQCATLSHandler( myTLS );
13
	myTestObject = new ClientStream( myConnector, myTLSHandler, 0);
13
	myTestObject = new ClientStream( myConnector, myTLSHandler, 0);
14
	// notify when the transport layer is connected
14
	// notify when the transport layer is connected
15
	connect( myTestObject, TQT_SIGNAL( connected() ), TQT_SLOT( slotConnected() ) );
15
	connect( myTestObject, TQT_SIGNAL( connected() ), TQT_SLOT( slotConnected() ) );
Lines 76-82 Link Here
76
	tqDebug( "TLS handshake complete" );
76
	tqDebug( "TLS handshake complete" );
77
	int validityResult = myTLS->certificateValidityResult ();
77
	int validityResult = myTLS->certificateValidityResult ();
78
78
79
	if( validityResult == QCA::TLS::Valid )
79
	if( validityResult == TQCA::TLS::Valid )
80
	{
80
	{
81
		tqDebug( "Certificate is valid, continuing.");
81
		tqDebug( "Certificate is valid, continuing.");
82
		// valid certificate, continue
82
		// valid certificate, continue
(-)tdenetwork/kopete/protocols/groupwise/libgroupwise/tests/clientstream_test.h (-2 / +2 lines)
Lines 50-57 Link Here
50
	
50
	
51
private:
51
private:
52
	KNetworkConnector *myConnector;
52
	KNetworkConnector *myConnector;
53
	QCA::TLS *myTLS;
53
	TQCA::TLS *myTLS;
54
	QCATLSHandler *myTLSHandler;
54
	TQCATLSHandler *myTLSHandler;
55
	ClientStream *myTestObject;
55
	ClientStream *myTestObject;
56
};
56
};
57
57
(-)tdenetwork/kopete/protocols/jabber/jabberaccount.cpp (-13 / +13 lines)
Lines 421-427 Link Here
421
		case JabberClient::NoTLS:
421
		case JabberClient::NoTLS:
422
			// no SSL support, at the connecting stage this means the problem is client-side
422
			// no SSL support, at the connecting stage this means the problem is client-side
423
			KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
423
			KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
424
								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.").
424
								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.").
425
								arg(myself()->contactId()),
425
								arg(myself()->contactId()),
426
								i18n ("Jabber SSL Error"));
426
								i18n ("Jabber SSL Error"));
427
			break;
427
			break;
Lines 451-503 Link Here
451
451
452
	switch ( warning )
452
	switch ( warning )
453
	{
453
	{
454
		case QCA::TLS::NoCert:
454
		case TQCA::TLS::NoCert:
455
			validityString = i18n("No certificate was presented.");
455
			validityString = i18n("No certificate was presented.");
456
			code = "NoCert";
456
			code = "NoCert";
457
			break;
457
			break;
458
		case QCA::TLS::HostMismatch:
458
		case TQCA::TLS::HostMismatch:
459
			validityString = i18n("The host name does not match the one in the certificate.");
459
			validityString = i18n("The host name does not match the one in the certificate.");
460
			code = "HostMismatch";
460
			code = "HostMismatch";
461
			break;
461
			break;
462
		case QCA::TLS::Rejected:
462
		case TQCA::TLS::Rejected:
463
			validityString = i18n("The Certificate Authority rejected the certificate.");
463
			validityString = i18n("The Certificate Authority rejected the certificate.");
464
			code = "Rejected";
464
			code = "Rejected";
465
			break;
465
			break;
466
		case QCA::TLS::Untrusted:
466
		case TQCA::TLS::Untrusted:
467
			// FIXME: write better error message here
467
			// FIXME: write better error message here
468
			validityString = i18n("The certificate is untrusted.");
468
			validityString = i18n("The certificate is untrusted.");
469
			code = "Untrusted";
469
			code = "Untrusted";
470
			break;
470
			break;
471
		case QCA::TLS::SignatureFailed:
471
		case TQCA::TLS::SignatureFailed:
472
			validityString = i18n("The signature is invalid.");
472
			validityString = i18n("The signature is invalid.");
473
			code = "SignatureFailed";
473
			code = "SignatureFailed";
474
			break;
474
			break;
475
		case QCA::TLS::InvalidCA:
475
		case TQCA::TLS::InvalidCA:
476
			validityString = i18n("The Certificate Authority is invalid.");
476
			validityString = i18n("The Certificate Authority is invalid.");
477
			code = "InvalidCA";
477
			code = "InvalidCA";
478
			break;
478
			break;
479
		case QCA::TLS::InvalidPurpose:
479
		case TQCA::TLS::InvalidPurpose:
480
			// FIXME: write better error  message here
480
			// FIXME: write better error  message here
481
			validityString = i18n("Invalid certificate purpose.");
481
			validityString = i18n("Invalid certificate purpose.");
482
			code = "InvalidPurpose";
482
			code = "InvalidPurpose";
483
			break;
483
			break;
484
		case QCA::TLS::SelfSigned:
484
		case TQCA::TLS::SelfSigned:
485
			validityString = i18n("The certificate is self-signed.");
485
			validityString = i18n("The certificate is self-signed.");
486
			code = "SelfSigned";
486
			code = "SelfSigned";
487
			break;
487
			break;
488
		case QCA::TLS::Revoked:
488
		case TQCA::TLS::Revoked:
489
			validityString = i18n("The certificate has been revoked.");
489
			validityString = i18n("The certificate has been revoked.");
490
			code = "Revoked";
490
			code = "Revoked";
491
			break;
491
			break;
492
		case QCA::TLS::PathLengthExceeded:
492
		case TQCA::TLS::PathLengthExceeded:
493
			validityString = i18n("Maximum certificate chain length was exceeded.");
493
			validityString = i18n("Maximum certificate chain length was exceeded.");
494
			code = "PathLengthExceeded";
494
			code = "PathLengthExceeded";
495
			break;
495
			break;
496
		case QCA::TLS::Expired:
496
		case TQCA::TLS::Expired:
497
			validityString = i18n("The certificate has expired.");
497
			validityString = i18n("The certificate has expired.");
498
			code = "Expired";
498
			code = "Expired";
499
			break;
499
			break;
500
		case QCA::TLS::Unknown:
500
		case TQCA::TLS::Unknown:
501
		default:
501
		default:
502
			validityString = i18n("An unknown error occurred trying to validate the certificate.");
502
			validityString = i18n("An unknown error occurred trying to validate the certificate.");
503
			code = "Unknown";
503
			code = "Unknown";
(-)tdenetwork/kopete/protocols/jabber/jabberaccount.h (-2 / +2 lines)
Lines 110-123 Link Here
110
110
111
	/*
111
	/*
112
	 * Handle TLS warnings. Displays a dialog and returns the user's choice.
112
	 * Handle TLS warnings. Displays a dialog and returns the user's choice.
113
	 * Parameters: Warning code from QCA::TLS
113
	 * Parameters: Warning code from TQCA::TLS
114
	 * Automatically resumes the stream if wanted.
114
	 * Automatically resumes the stream if wanted.
115
	 */
115
	 */
116
	/**
116
	/**
117
	 * Handle a TLS warning. Displays a dialog and returns if the
117
	 * Handle a TLS warning. Displays a dialog and returns if the
118
	 * stream can be continued or not.
118
	 * stream can be continued or not.
119
	 * @param client JabberClient instance
119
	 * @param client JabberClient instance
120
	 * @param warning Warning code from QCA::TLS
120
	 * @param warning Warning code from TQCA::TLS
121
	 * @return True if stream can be resumed.
121
	 * @return True if stream can be resumed.
122
	 */
122
	 */
123
	static bool handleTLSWarning ( JabberClient *client, int warning );
123
	static bool handleTLSWarning ( JabberClient *client, int warning );
(-)tdenetwork/kopete/protocols/jabber/jabberclient.cpp (-9 / +9 lines)
Lines 61-68 Link Here
61
	XMPP::Client *jabberClient;
61
	XMPP::Client *jabberClient;
62
	XMPP::ClientStream *jabberClientStream;
62
	XMPP::ClientStream *jabberClientStream;
63
	JabberConnector *jabberClientConnector;
63
	JabberConnector *jabberClientConnector;
64
	QCA::TLS *jabberTLS;
64
	TQCA::TLS *jabberTLS;
65
	XMPP::QCATLSHandler *jabberTLSHandler;
65
	XMPP::TQCATLSHandler *jabberTLSHandler;
66
66
67
	// ignore TLS warnings
67
	// ignore TLS warnings
68
	bool ignoreTLSWarnings;
68
	bool ignoreTLSWarnings;
Lines 603-609 Link Here
603
	/*
603
	/*
604
	 * Return an error if we should force TLS but it's not available.
604
	 * Return an error if we should force TLS but it's not available.
605
	 */
605
	 */
606
	if ( ( forceTLS () || useSSL () || probeSSL () ) && !QCA::isSupported ( QCA::CAP_TLS ) )
606
	if ( ( forceTLS () || useSSL () || probeSSL () ) && !TQCA::isSupported ( TQCA::CAP_TLS ) )
607
	{
607
	{
608
		return NoTLS;
608
		return NoTLS;
609
	}
609
	}
Lines 631-647 Link Here
631
	/*
631
	/*
632
	 * Setup authentication layer
632
	 * Setup authentication layer
633
	 */
633
	 */
634
	if ( QCA::isSupported ( QCA::CAP_TLS ) )
634
	if ( TQCA::isSupported ( TQCA::CAP_TLS ) )
635
	{
635
	{
636
		d->jabberTLS = new QCA::TLS;
636
		d->jabberTLS = new TQCA::TLS;
637
		d->jabberTLSHandler = new XMPP::QCATLSHandler ( d->jabberTLS );
637
		d->jabberTLSHandler = new XMPP::TQCATLSHandler ( d->jabberTLS );
638
638
639
		{
639
		{
640
			using namespace XMPP;
640
			using namespace XMPP;
641
			TQObject::connect ( d->jabberTLSHandler, TQT_SIGNAL ( tlsHandshaken() ), this, TQT_SLOT ( slotTLSHandshaken () ) );
641
			TQObject::connect ( d->jabberTLSHandler, TQT_SIGNAL ( tlsHandshaken() ), this, TQT_SLOT ( slotTLSHandshaken () ) );
642
		}
642
		}
643
643
644
		TQPtrList<QCA::Cert> certStore;
644
		TQPtrList<TQCA::Cert> certStore;
645
		d->jabberTLS->setCertificateStore ( certStore );
645
		d->jabberTLS->setCertificateStore ( certStore );
646
	}
646
	}
647
647
Lines 893-902 Link Here
893
893
894
	emit debugMessage ( "TLS handshake done, testing certificate validity..." );
894
	emit debugMessage ( "TLS handshake done, testing certificate validity..." );
895
895
896
	// FIXME: in the future, this should be handled by KDE, not QCA
896
	// FIXME: in the future, this should be handled by KDE, not TQCA
897
	int validityResult = d->jabberTLS->certificateValidityResult ();
897
	int validityResult = d->jabberTLS->certificateValidityResult ();
898
898
899
	if ( validityResult == QCA::TLS::Valid )
899
	if ( validityResult == TQCA::TLS::Valid )
900
	{
900
	{
901
		emit debugMessage ( "Certificate is valid, continuing." );
901
		emit debugMessage ( "Certificate is valid, continuing." );
902
902
(-)tdenetwork/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.cpp (-1 / +1 lines)
Lines 53-59 Link Here
53
	if(n == 0)
53
	if(n == 0)
54
		return s;
54
		return s;
55
	else
55
	else
56
		return Base64::arrayToString( QCA::SHA1::hash( TQCString(hpk(n - 1, s).latin1()) ) );
56
		return Base64::arrayToString( TQCA::SHA1::hash( TQCString(hpk(n - 1, s).latin1()) ) );
57
}
57
}
58
58
59
class HttpPoll::Private
59
class HttpPoll::Private
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/include/xmpp.h (-6 / +6 lines)
Lines 29-35 Link Here
29
#include<tqxml.h>
29
#include<tqxml.h>
30
#include<tqdom.h>
30
#include<tqdom.h>
31
31
32
namespace QCA
32
namespace TQCA
33
{
33
{
34
	class TLS;
34
	class TLS;
35
}
35
}
Lines 189-203 Link Here
189
		void readyReadOutgoing(const TQByteArray &a, int plainBytes);
189
		void readyReadOutgoing(const TQByteArray &a, int plainBytes);
190
	};
190
	};
191
191
192
	class QCATLSHandler : public TLSHandler
192
	class TQCATLSHandler : public TLSHandler
193
	{
193
	{
194
		Q_OBJECT
194
		Q_OBJECT
195
  
195
  
196
	public:
196
	public:
197
		QCATLSHandler(QCA::TLS *parent);
197
		TQCATLSHandler(TQCA::TLS *parent);
198
		~QCATLSHandler();
198
		~TQCATLSHandler();
199
199
200
		QCA::TLS *tls() const;
200
		TQCA::TLS *tls() const;
201
		int tlsError() const;
201
		int tlsError() const;
202
202
203
		void reset();
203
		void reset();
Lines 457-463 Link Here
457
		};
457
		};
458
458
459
		ClientStream(Connector *conn, TLSHandler *tlsHandler=0, TQObject *parent=0);
459
		ClientStream(Connector *conn, TLSHandler *tlsHandler=0, TQObject *parent=0);
460
		ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, QCA::TLS *tls=0, TQObject *parent=0); // server
460
		ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, TQCA::TLS *tls=0, TQObject *parent=0); // server
461
		~ClientStream();
461
		~ClientStream();
462
462
463
		Jid jid() const;
463
		Jid jid() const;
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/jabber/s5b.cpp (-3 / +3 lines)
Lines 49-55 Link Here
49
static TQString makeKey(const TQString &sid, const Jid &initiator, const Jid &target)
49
static TQString makeKey(const TQString &sid, const Jid &initiator, const Jid &target)
50
{
50
{
51
	TQString str = sid + initiator.full() + target.full();
51
	TQString str = sid + initiator.full() + target.full();
52
	return QCA::SHA1::hashToString(str.utf8());
52
	return TQCA::SHA1::hashToString(str.utf8());
53
}
53
}
54
54
55
static bool haveHost(const StreamHostList &list, const Jid &j)
55
static bool haveHost(const StreamHostList &list, const Jid &j)
Lines 579-586 Link Here
579
:TQObject(parent)
579
:TQObject(parent)
580
{
580
{
581
	// S5B needs SHA1
581
	// S5B needs SHA1
582
	if(!QCA::isSupported(QCA::CAP_SHA1))
582
	if(!TQCA::isSupported(TQCA::CAP_SHA1))
583
		QCA::insertProvider(createProviderHash());
583
		TQCA::insertProvider(createProviderHash());
584
584
585
	d = new Private;
585
	d = new Private;
586
	d->client = parent;
586
	d->client = parent;
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/connector.cpp (-2 / +2 lines)
Lines 321-328 Link Here
321
321
322
	if(d->proxy.type() == Proxy::HttpPoll) {
322
	if(d->proxy.type() == Proxy::HttpPoll) {
323
		// need SHA1 here
323
		// need SHA1 here
324
		if(!QCA::isSupported(QCA::CAP_SHA1))
324
		if(!TQCA::isSupported(TQCA::CAP_SHA1))
325
			QCA::insertProvider(createProviderHash());
325
			TQCA::insertProvider(createProviderHash());
326
326
327
		HttpPoll *s = new HttpPoll;
327
		HttpPoll *s = new HttpPoll;
328
		d->bs = s;
328
		d->bs = s;
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/hash.cpp (-10 / +10 lines)
Lines 447-453 Link Here
447
	TQ_UINT32 l[16];
447
	TQ_UINT32 l[16];
448
} CHAR64LONG16;
448
} CHAR64LONG16;
449
449
450
class SHA1Context : public QCA_HashContext
450
class SHA1Context : public TQCA_HashContext
451
{
451
{
452
public:
452
public:
453
	SHA1_CONTEXT _context;
453
	SHA1_CONTEXT _context;
Lines 458-464 Link Here
458
		reset();
458
		reset();
459
	}
459
	}
460
460
461
	QCA_HashContext *clone()
461
	TQCA_HashContext *clone()
462
	{
462
	{
463
		return new SHA1Context(*this);
463
		return new SHA1Context(*this);
464
	}
464
	}
Lines 598-604 Link Here
598
	}
598
	}
599
};
599
};
600
600
601
class MD5Context : public QCA_HashContext
601
class MD5Context : public TQCA_HashContext
602
{
602
{
603
public:
603
public:
604
	MD5Context()
604
	MD5Context()
Lines 606-612 Link Here
606
		reset();
606
		reset();
607
	}
607
	}
608
608
609
	QCA_HashContext *clone()
609
	TQCA_HashContext *clone()
610
	{
610
	{
611
		return new MD5Context(*this);
611
		return new MD5Context(*this);
612
	}
612
	}
Lines 631-637 Link Here
631
	md5_state_t md5;
631
	md5_state_t md5;
632
};
632
};
633
633
634
class HashProvider : public QCAProvider
634
class HashProvider : public TQCAProvider
635
{
635
{
636
public:
636
public:
637
	HashProvider() {}
637
	HashProvider() {}
Lines 644-668 Link Here
644
644
645
	int qcaVersion() const
645
	int qcaVersion() const
646
	{
646
	{
647
		return QCA_PLUGIN_VERSION;
647
		return TQCA_PLUGIN_VERSION;
648
	}
648
	}
649
649
650
	int capabilities() const
650
	int capabilities() const
651
	{
651
	{
652
		return (QCA::CAP_SHA1 | QCA::CAP_MD5);
652
		return (TQCA::CAP_SHA1 | TQCA::CAP_MD5);
653
	}
653
	}
654
654
655
	void *context(int cap)
655
	void *context(int cap)
656
	{
656
	{
657
		if(cap == QCA::CAP_SHA1)
657
		if(cap == TQCA::CAP_SHA1)
658
			return new SHA1Context;
658
			return new SHA1Context;
659
		if(cap == QCA::CAP_MD5)
659
		if(cap == TQCA::CAP_MD5)
660
			return new MD5Context;
660
			return new MD5Context;
661
		return 0;
661
		return 0;
662
	}
662
	}
663
};
663
};
664
664
665
QCAProvider *createProviderHash()
665
TQCAProvider *createProviderHash()
666
{
666
{
667
	return (new HashProvider);
667
	return (new HashProvider);
668
}
668
}
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/hash.h (-1 / +1 lines)
Lines 25-31 Link Here
25
25
26
namespace XMPP
26
namespace XMPP
27
{
27
{
28
	QCAProvider *createProviderHash();
28
	TQCAProvider *createProviderHash();
29
}
29
}
30
30
31
#endif
31
#endif
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/protocol.cpp (-3 / +3 lines)
Lines 1189-1200 Link Here
1189
		TQDomElement p;
1189
		TQDomElement p;
1190
		if(digest) {
1190
		if(digest) {
1191
			// need SHA1 here
1191
			// need SHA1 here
1192
			if(!QCA::isSupported(QCA::CAP_SHA1))
1192
			if(!TQCA::isSupported(TQCA::CAP_SHA1))
1193
				QCA::insertProvider(createProviderHash());
1193
				TQCA::insertProvider(createProviderHash());
1194
1194
1195
			p = doc.createElement("digest");
1195
			p = doc.createElement("digest");
1196
			TQCString cs = id.utf8() + password.utf8();
1196
			TQCString cs = id.utf8() + password.utf8();
1197
			p.appendChild(doc.createTextNode(QCA::SHA1::hashToString(cs)));
1197
			p.appendChild(doc.createTextNode(TQCA::SHA1::hashToString(cs)));
1198
		}
1198
		}
1199
		else {
1199
		else {
1200
			p = doc.createElement("password");
1200
			p = doc.createElement("password");
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/qcaprovider.h (-33 / +33 lines)
Lines 1-5 Link Here
1
/*
1
/*
2
 * qcaprovider.h - QCA Plugin API
2
 * qcaprovider.h - TQCA Plugin API
3
 * Copyright (C) 2003  Justin Karneges
3
 * Copyright (C) 2003  Justin Karneges
4
 *
4
 *
5
 * This library is free software; you can redistribute it and/or
5
 * This library is free software; you can redistribute it and/or
Lines 18-25 Link Here
18
 *
18
 *
19
 */
19
 */
20
20
21
#ifndef QCAPROVIDER_H
21
#ifndef TQCAPROVIDER_H
22
#define QCAPROVIDER_H
22
#define TQCAPROVIDER_H
23
23
24
#include<tqglobal.h>
24
#include<tqglobal.h>
25
#include<tqstring.h>
25
#include<tqstring.h>
Lines 28-40 Link Here
28
#include<tqhostaddress.h>
28
#include<tqhostaddress.h>
29
#include"qca.h"
29
#include"qca.h"
30
30
31
#define QCA_PLUGIN_VERSION 1
31
#define TQCA_PLUGIN_VERSION 1
32
32
33
class QCAProvider
33
class TQCAProvider
34
{
34
{
35
public:
35
public:
36
	QCAProvider() {}
36
	TQCAProvider() {}
37
	virtual ~QCAProvider() {}
37
	virtual ~TQCAProvider() {}
38
38
39
	virtual void init()=0;
39
	virtual void init()=0;
40
	virtual int qcaVersion() const=0;
40
	virtual int qcaVersion() const=0;
Lines 42-64 Link Here
42
	virtual void *context(int cap)=0;
42
	virtual void *context(int cap)=0;
43
};
43
};
44
44
45
class QCA_HashContext
45
class TQCA_HashContext
46
{
46
{
47
public:
47
public:
48
	virtual ~QCA_HashContext() {}
48
	virtual ~TQCA_HashContext() {}
49
49
50
	virtual QCA_HashContext *clone()=0;
50
	virtual TQCA_HashContext *clone()=0;
51
	virtual void reset()=0;
51
	virtual void reset()=0;
52
	virtual void update(const char *in, unsigned int len)=0;
52
	virtual void update(const char *in, unsigned int len)=0;
53
	virtual void final(TQByteArray *out)=0;
53
	virtual void final(TQByteArray *out)=0;
54
};
54
};
55
55
56
class QCA_CipherContext
56
class TQCA_CipherContext
57
{
57
{
58
public:
58
public:
59
	virtual ~QCA_CipherContext() {}
59
	virtual ~TQCA_CipherContext() {}
60
60
61
	virtual QCA_CipherContext *clone()=0;
61
	virtual TQCA_CipherContext *clone()=0;
62
	virtual int keySize()=0;
62
	virtual int keySize()=0;
63
	virtual int blockSize()=0;
63
	virtual int blockSize()=0;
64
	virtual bool generateKey(char *out, int keysize=-1)=0;
64
	virtual bool generateKey(char *out, int keysize=-1)=0;
Lines 69-80 Link Here
69
	virtual bool final(TQByteArray *out)=0;
69
	virtual bool final(TQByteArray *out)=0;
70
};
70
};
71
71
72
class QCA_RSAKeyContext
72
class TQCA_RSAKeyContext
73
{
73
{
74
public:
74
public:
75
	virtual ~QCA_RSAKeyContext() {}
75
	virtual ~TQCA_RSAKeyContext() {}
76
76
77
	virtual QCA_RSAKeyContext *clone() const=0;
77
	virtual TQCA_RSAKeyContext *clone() const=0;
78
	virtual bool isNull() const=0;
78
	virtual bool isNull() const=0;
79
	virtual bool havePublic() const=0;
79
	virtual bool havePublic() const=0;
80
	virtual bool havePrivate() const=0;
80
	virtual bool havePrivate() const=0;
Lines 89-106 Link Here
89
	virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
89
	virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
90
};
90
};
91
91
92
struct QCA_CertProperty
92
struct TQCA_CertProperty
93
{
93
{
94
	TQString var;
94
	TQString var;
95
	TQString val;
95
	TQString val;
96
};
96
};
97
97
98
class QCA_CertContext
98
class TQCA_CertContext
99
{
99
{
100
public:
100
public:
101
	virtual ~QCA_CertContext() {}
101
	virtual ~TQCA_CertContext() {}
102
102
103
	virtual QCA_CertContext *clone() const=0;
103
	virtual TQCA_CertContext *clone() const=0;
104
	virtual bool isNull() const=0;
104
	virtual bool isNull() const=0;
105
	virtual bool createFromDER(const char *in, unsigned int len)=0;
105
	virtual bool createFromDER(const char *in, unsigned int len)=0;
106
	virtual bool createFromPEM(const char *in, unsigned int len)=0;
106
	virtual bool createFromPEM(const char *in, unsigned int len)=0;
Lines 110-131 Link Here
110
	virtual TQString serialNumber() const=0;
110
	virtual TQString serialNumber() const=0;
111
	virtual TQString subjectString() const=0;
111
	virtual TQString subjectString() const=0;
112
	virtual TQString issuerString() const=0;
112
	virtual TQString issuerString() const=0;
113
	virtual TQValueList<QCA_CertProperty> subject() const=0;
113
	virtual TQValueList<TQCA_CertProperty> subject() const=0;
114
	virtual TQValueList<QCA_CertProperty> issuer() const=0;
114
	virtual TQValueList<TQCA_CertProperty> issuer() const=0;
115
	virtual TQDateTime notBefore() const=0;
115
	virtual TQDateTime notBefore() const=0;
116
	virtual TQDateTime notAfter() const=0;
116
	virtual TQDateTime notAfter() const=0;
117
	virtual bool matchesAddress(const TQString &realHost) const=0;
117
	virtual bool matchesAddress(const TQString &realHost) const=0;
118
};
118
};
119
119
120
class QCA_TLSContext
120
class TQCA_TLSContext
121
{
121
{
122
public:
122
public:
123
	enum Result { Success, Error, Continue };
123
	enum Result { Success, Error, Continue };
124
	virtual ~QCA_TLSContext() {}
124
	virtual ~TQCA_TLSContext() {}
125
125
126
	virtual void reset()=0;
126
	virtual void reset()=0;
127
	virtual bool startClient(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
127
	virtual bool startClient(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
128
	virtual bool startServer(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
128
	virtual bool startServer(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
129
129
130
	virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
130
	virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
131
	virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
131
	virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
Lines 134-163 Link Here
134
	virtual bool eof() const=0;
134
	virtual bool eof() const=0;
135
	virtual TQByteArray unprocessed()=0;
135
	virtual TQByteArray unprocessed()=0;
136
136
137
	virtual QCA_CertContext *peerCertificate() const=0;
137
	virtual TQCA_CertContext *peerCertificate() const=0;
138
	virtual int validityResult() const=0;
138
	virtual int validityResult() const=0;
139
};
139
};
140
140
141
struct QCA_SASLHostPort
141
struct TQCA_SASLHostPort
142
{
142
{
143
	TQHostAddress addr;
143
	TQHostAddress addr;
144
	TQ_UINT16 port;
144
	TQ_UINT16 port;
145
};
145
};
146
146
147
struct QCA_SASLNeedParams
147
struct TQCA_SASLNeedParams
148
{
148
{
149
	bool user, authzid, pass, realm;
149
	bool user, authzid, pass, realm;
150
};
150
};
151
151
152
class QCA_SASLContext
152
class TQCA_SASLContext
153
{
153
{
154
public:
154
public:
155
	enum Result { Success, Error, NeedParams, AuthCheck, Continue };
155
	enum Result { Success, Error, NeedParams, AuthCheck, Continue };
156
	virtual ~QCA_SASLContext() {}
156
	virtual ~TQCA_SASLContext() {}
157
157
158
	// common
158
	// common
159
	virtual void reset()=0;
159
	virtual void reset()=0;
160
	virtual void setCoreProps(const TQString &service, const TQString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0;
160
	virtual void setCoreProps(const TQString &service, const TQString &host, TQCA_SASLHostPort *local, TQCA_SASLHostPort *remote)=0;
161
	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;
161
	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;
162
	virtual int security() const=0;
162
	virtual int security() const=0;
163
	virtual int errorCond() const=0;
163
	virtual int errorCond() const=0;
Lines 169-175 Link Here
169
	virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
169
	virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
170
170
171
	// get / set params
171
	// get / set params
172
	virtual QCA_SASLNeedParams clientParamsNeeded() const=0;
172
	virtual TQCA_SASLNeedParams clientParamsNeeded() const=0;
173
	virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
173
	virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
174
	virtual TQString username() const=0;
174
	virtual TQString username() const=0;
175
	virtual TQString authzid() const=0;
175
	virtual TQString authzid() const=0;
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/securestream.cpp (-9 / +9 lines)
Lines 22-28 Link Here
22
  Note: SecureStream depends on the underlying security layers to signal
22
  Note: SecureStream depends on the underlying security layers to signal
23
    plain-to-encrypted results immediately (as opposed to waiting for the
23
    plain-to-encrypted results immediately (as opposed to waiting for the
24
    event loop) so that the user cannot add/remove security layers during
24
    event loop) so that the user cannot add/remove security layers during
25
    this conversion moment.  QCA::TLS and QCA::SASL behave as expected,
25
    this conversion moment.  TQCA::TLS and TQCA::SASL behave as expected,
26
    but future layers might not.
26
    but future layers might not.
27
*/
27
*/
28
28
Lines 117-124 Link Here
117
	enum { TLS, SASL, TLSH };
117
	enum { TLS, SASL, TLSH };
118
	int type;
118
	int type;
119
	union {
119
	union {
120
		QCA::TLS *tls;
120
		TQCA::TLS *tls;
121
		QCA::SASL *sasl;
121
		TQCA::SASL *sasl;
122
#ifdef USE_TLSHANDLER
122
#ifdef USE_TLSHANDLER
123
		XMPP::TLSHandler *tlsHandler;
123
		XMPP::TLSHandler *tlsHandler;
124
#endif
124
#endif
Lines 127-133 Link Here
127
	bool tls_done;
127
	bool tls_done;
128
	int prebytes;
128
	int prebytes;
129
129
130
	SecureLayer(QCA::TLS *t)
130
	SecureLayer(TQCA::TLS *t)
131
	{
131
	{
132
		type = TLS;
132
		type = TLS;
133
		p.tls = t;
133
		p.tls = t;
Lines 139-145 Link Here
139
		connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
139
		connect(p.tls, TQT_SIGNAL(error(int)), TQT_SLOT(tls_error(int)));
140
	}
140
	}
141
141
142
	SecureLayer(QCA::SASL *s)
142
	SecureLayer(TQCA::SASL *s)
143
	{
143
	{
144
		type = SASL;
144
		type = SASL;
145
		p.sasl = s;
145
		p.sasl = s;
Lines 381-387 Link Here
381
	return (d->pending - x);
381
	return (d->pending - x);
382
}
382
}
383
383
384
void SecureStream::startTLSClient(QCA::TLS *t, const TQByteArray &spare)
384
void SecureStream::startTLSClient(TQCA::TLS *t, const TQByteArray &spare)
385
{
385
{
386
	if(!d->active || d->topInProgress || d->haveTLS())
386
	if(!d->active || d->topInProgress || d->haveTLS())
387
		return;
387
		return;
Lines 395-401 Link Here
395
	insertData(spare);
395
	insertData(spare);
396
}
396
}
397
397
398
void SecureStream::startTLSServer(QCA::TLS *t, const TQByteArray &spare)
398
void SecureStream::startTLSServer(TQCA::TLS *t, const TQByteArray &spare)
399
{
399
{
400
	if(!d->active || d->topInProgress || d->haveTLS())
400
	if(!d->active || d->topInProgress || d->haveTLS())
401
		return;
401
		return;
Lines 409-415 Link Here
409
	insertData(spare);
409
	insertData(spare);
410
}
410
}
411
411
412
void SecureStream::setLayerSASL(QCA::SASL *sasl, const TQByteArray &spare)
412
void SecureStream::setLayerSASL(TQCA::SASL *sasl, const TQByteArray &spare)
413
{
413
{
414
	if(!d->active || d->topInProgress || d->haveSASL())
414
	if(!d->active || d->topInProgress || d->haveSASL())
415
		return;
415
		return;
Lines 434-440 Link Here
434
	d->layers.append(s);
434
	d->layers.append(s);
435
	d->topInProgress = true;
435
	d->topInProgress = true;
436
436
437
	// unlike QCA::TLS, XMPP::TLSHandler has no return value
437
	// unlike TQCA::TLS, XMPP::TLSHandler has no return value
438
	s->p.tlsHandler->startClient(server);
438
	s->p.tlsHandler->startClient(server);
439
439
440
	insertData(spare);
440
	insertData(spare);
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/securestream.h (-3 / +3 lines)
Lines 42-50 Link Here
42
	SecureStream(ByteStream *s);
42
	SecureStream(ByteStream *s);
43
	~SecureStream();
43
	~SecureStream();
44
44
45
	void startTLSClient(QCA::TLS *t, const TQByteArray &spare=TQByteArray());
45
	void startTLSClient(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
46
	void startTLSServer(QCA::TLS *t, const TQByteArray &spare=TQByteArray());
46
	void startTLSServer(TQCA::TLS *t, const TQByteArray &spare=TQByteArray());
47
	void setLayerSASL(QCA::SASL *s, const TQByteArray &spare=TQByteArray());
47
	void setLayerSASL(TQCA::SASL *s, const TQByteArray &spare=TQByteArray());
48
#ifdef USE_TLSHANDLER
48
#ifdef USE_TLSHANDLER
49
	void startTLSClient(XMPP::TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray());
49
	void startTLSClient(XMPP::TLSHandler *t, const TQString &server, const TQByteArray &spare=TQByteArray());
50
#endif
50
#endif
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp (-19 / +19 lines)
Lines 143-149 Link Here
143
	}
143
	}
144
};
144
};
145
145
146
class SimpleSASLContext : public QCA_SASLContext
146
class SimpleSASLContext : public TQCA_SASLContext
147
{
147
{
148
public:
148
public:
149
	// core props
149
	// core props
Lines 157-164 Link Here
157
	bool capable;
157
	bool capable;
158
	int err;
158
	int err;
159
159
160
	QCA_SASLNeedParams need;
160
	TQCA_SASLNeedParams need;
161
	QCA_SASLNeedParams have;
161
	TQCA_SASLNeedParams have;
162
	TQString user, authz, pass, realm;
162
	TQString user, authz, pass, realm;
163
163
164
	SimpleSASLContext()
164
	SimpleSASLContext()
Lines 201-207 Link Here
201
		realm = TQString();
201
		realm = TQString();
202
	}
202
	}
203
203
204
	void setCoreProps(const TQString &_service, const TQString &_host, QCA_SASLHostPort *, QCA_SASLHostPort *)
204
	void setCoreProps(const TQString &_service, const TQString &_host, TQCA_SASLHostPort *, TQCA_SASLHostPort *)
205
	{
205
	{
206
		service = _service;
206
		service = _service;
207
		host = _host;
207
		host = _host;
Lines 235-241 Link Here
235
			}
235
			}
236
		}
236
		}
237
		if(!capable || !haveMech) {
237
		if(!capable || !haveMech) {
238
			err = QCA::SASL::NoMech;
238
			err = TQCA::SASL::NoMech;
239
			return false;
239
			return false;
240
		}
240
		}
241
241
Lines 259-265 Link Here
259
		return Error;
259
		return Error;
260
	}
260
	}
261
261
262
	QCA_SASLNeedParams clientParamsNeeded() const
262
	TQCA_SASLNeedParams clientParamsNeeded() const
263
	{
263
	{
264
		return need;
264
		return need;
265
	}
265
	}
Lines 352-358 Link Here
352
			TQCString cs(in_buf.data(), in_buf.size()+1);
352
			TQCString cs(in_buf.data(), in_buf.size()+1);
353
			PropList in;
353
			PropList in;
354
			if(!in.fromString(cs)) {
354
			if(!in.fromString(cs)) {
355
				err = QCA::SASL::BadProto;
355
				err = TQCA::SASL::BadProto;
356
				return Error;
356
				return Error;
357
			}
357
			}
358
358
Lines 371-386 Link Here
371
371
372
			// build 'response'
372
			// build 'response'
373
			TQCString X = user.utf8() + ':' + realm.utf8() + ':' + pass.utf8();
373
			TQCString X = user.utf8() + ':' + realm.utf8() + ':' + pass.utf8();
374
			TQByteArray Y = QCA::MD5::hash(X);
374
			TQByteArray Y = TQCA::MD5::hash(X);
375
			TQCString tmp = TQCString(":") + nonce + ':' + cnonce + ':' + authz.utf8();
375
			TQCString tmp = TQCString(":") + nonce + ':' + cnonce + ':' + authz.utf8();
376
			TQByteArray A1(Y.size() + tmp.length());
376
			TQByteArray A1(Y.size() + tmp.length());
377
			memcpy(A1.data(), Y.data(), Y.size());
377
			memcpy(A1.data(), Y.data(), Y.size());
378
			memcpy(A1.data() + Y.size(), tmp.data(), tmp.length());
378
			memcpy(A1.data() + Y.size(), tmp.data(), tmp.length());
379
			TQCString A2 = "AUTHENTICATE:" + uri;
379
			TQCString A2 = "AUTHENTICATE:" + uri;
380
			TQCString HA1 = QCA::MD5::hashToString(A1).latin1();
380
			TQCString HA1 = TQCA::MD5::hashToString(A1).latin1();
381
			TQCString HA2 = QCA::MD5::hashToString(A2).latin1();
381
			TQCString HA2 = TQCA::MD5::hashToString(A2).latin1();
382
			TQCString KD = HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2;
382
			TQCString KD = HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2;
383
			TQCString Z = QCA::MD5::hashToString(KD).latin1();
383
			TQCString Z = TQCA::MD5::hashToString(KD).latin1();
384
384
385
			// build output
385
			// build output
386
			PropList out;
386
			PropList out;
Lines 423-433 Link Here
423
	}
423
	}
424
};
424
};
425
425
426
class QCASimpleSASL : public QCAProvider
426
class TQCASimpleSASL : public TQCAProvider
427
{
427
{
428
public:
428
public:
429
	QCASimpleSASL() {}
429
	TQCASimpleSASL() {}
430
	~QCASimpleSASL() {}
430
	~TQCASimpleSASL() {}
431
431
432
	void init()
432
	void init()
433
	{
433
	{
Lines 435-459 Link Here
435
435
436
	int qcaVersion() const
436
	int qcaVersion() const
437
	{
437
	{
438
		return QCA_PLUGIN_VERSION;
438
		return TQCA_PLUGIN_VERSION;
439
	}
439
	}
440
440
441
	int capabilities() const
441
	int capabilities() const
442
	{
442
	{
443
		return QCA::CAP_SASL;
443
		return TQCA::CAP_SASL;
444
	}
444
	}
445
445
446
	void *context(int cap)
446
	void *context(int cap)
447
	{
447
	{
448
		if(cap == QCA::CAP_SASL)
448
		if(cap == TQCA::CAP_SASL)
449
			return new SimpleSASLContext;
449
			return new SimpleSASLContext;
450
		return 0;
450
		return 0;
451
	}
451
	}
452
};
452
};
453
453
454
QCAProvider *createProviderSimpleSASL()
454
TQCAProvider *createProviderSimpleSASL()
455
{
455
{
456
	return (new QCASimpleSASL);
456
	return (new TQCASimpleSASL);
457
}
457
}
458
458
459
}
459
}
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.h (-1 / +1 lines)
Lines 25-31 Link Here
25
25
26
namespace XMPP
26
namespace XMPP
27
{
27
{
28
	QCAProvider *createProviderSimpleSASL();
28
	TQCAProvider *createProviderSimpleSASL();
29
}
29
}
30
30
31
#endif
31
#endif
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/stream.cpp (-19 / +19 lines)
Lines 81-90 Link Here
81
static TQString genId()
81
static TQString genId()
82
{
82
{
83
	// need SHA1 here
83
	// need SHA1 here
84
	if(!QCA::isSupported(QCA::CAP_SHA1))
84
	if(!TQCA::isSupported(TQCA::CAP_SHA1))
85
		QCA::insertProvider(createProviderHash());
85
		TQCA::insertProvider(createProviderHash());
86
86
87
	return QCA::SHA1::hashToString(randomArray(128));
87
	return TQCA::SHA1::hashToString(randomArray(128));
88
}
88
}
89
89
90
//----------------------------------------------------------------------------
90
//----------------------------------------------------------------------------
Lines 584-591 Link Here
584
	Connector *conn;
584
	Connector *conn;
585
	ByteStream *bs;
585
	ByteStream *bs;
586
	TLSHandler *tlsHandler;
586
	TLSHandler *tlsHandler;
587
	QCA::TLS *tls;
587
	TQCA::TLS *tls;
588
	QCA::SASL *sasl;
588
	TQCA::SASL *sasl;
589
	SecureStream *ss;
589
	SecureStream *ss;
590
	CoreProtocol client;
590
	CoreProtocol client;
591
	CoreProtocol srv;
591
	CoreProtocol srv;
Lines 627-633 Link Here
627
	d->tlsHandler = tlsHandler;
627
	d->tlsHandler = tlsHandler;
628
}
628
}
629
629
630
ClientStream::ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, QCA::TLS *tls, TQObject *parent)
630
ClientStream::ClientStream(const TQString &host, const TQString &defRealm, ByteStream *bs, TQCA::TLS *tls, TQObject *parent)
631
:Stream(parent)
631
:Stream(parent)
632
{
632
{
633
	d = new Private;
633
	d = new Private;
Lines 1162-1168 Link Here
1162
			}
1162
			}
1163
			else if(need == CoreProtocol::NSASLMechs) {
1163
			else if(need == CoreProtocol::NSASLMechs) {
1164
				if(!d->sasl) {
1164
				if(!d->sasl) {
1165
					d->sasl = new QCA::SASL;
1165
					d->sasl = new TQCA::SASL;
1166
					connect(d->sasl, TQT_SIGNAL(authCheck(const TQString &, const TQString &)), TQT_SLOT(sasl_authCheck(const TQString &, const TQString &)));
1166
					connect(d->sasl, TQT_SIGNAL(authCheck(const TQString &, const TQString &)), TQT_SLOT(sasl_authCheck(const TQString &, const TQString &)));
1167
					connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &)));
1167
					connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &)));
1168
					connect(d->sasl, TQT_SIGNAL(authenticated()), TQT_SLOT(sasl_authenticated()));
1168
					connect(d->sasl, TQT_SIGNAL(authenticated()), TQT_SLOT(sasl_authenticated()));
Lines 1241-1249 Link Here
1241
				printf("Break (RecvOpen)\n");
1241
				printf("Break (RecvOpen)\n");
1242
1242
1243
				// calculate key
1243
				// calculate key
1244
				TQCString str = QCA::SHA1::hashToString(TQCString("secret")).utf8();
1244
				TQCString str = TQCA::SHA1::hashToString(TQCString("secret")).utf8();
1245
				str = QCA::SHA1::hashToString(str + "im.pyxa.org").utf8();
1245
				str = TQCA::SHA1::hashToString(str + "im.pyxa.org").utf8();
1246
				str = QCA::SHA1::hashToString(str + d->srv.id.utf8()).utf8();
1246
				str = TQCA::SHA1::hashToString(str + d->srv.id.utf8()).utf8();
1247
				d->srv.setDialbackKey(str);
1247
				d->srv.setDialbackKey(str);
1248
1248
1249
				//d->srv.setDialbackKey("3c5d721ea2fcc45b163a11420e4e358f87e3142a");
1249
				//d->srv.setDialbackKey("3c5d721ea2fcc45b163a11420e4e358f87e3142a");
Lines 1472-1485 Link Here
1472
			printf("Need SASL First Step\n");
1472
			printf("Need SASL First Step\n");
1473
#endif
1473
#endif
1474
			// no SASL plugin?  fall back to Simple SASL
1474
			// no SASL plugin?  fall back to Simple SASL
1475
			if(!QCA::isSupported(QCA::CAP_SASL)) {
1475
			if(!TQCA::isSupported(TQCA::CAP_SASL)) {
1476
				// Simple SASL needs MD5.  do we have that either?
1476
				// Simple SASL needs MD5.  do we have that either?
1477
				if(!QCA::isSupported(QCA::CAP_MD5))
1477
				if(!TQCA::isSupported(TQCA::CAP_MD5))
1478
					QCA::insertProvider(createProviderHash());
1478
					TQCA::insertProvider(createProviderHash());
1479
				QCA::insertProvider(createProviderSimpleSASL());
1479
				TQCA::insertProvider(createProviderSimpleSASL());
1480
			}
1480
			}
1481
1481
1482
			d->sasl = new QCA::SASL;
1482
			d->sasl = new TQCA::SASL;
1483
			connect(d->sasl, TQT_SIGNAL(clientFirstStep(const TQString &, const TQByteArray *)), TQT_SLOT(sasl_clientFirstStep(const TQString &, const TQByteArray *)));
1483
			connect(d->sasl, TQT_SIGNAL(clientFirstStep(const TQString &, const TQByteArray *)), TQT_SLOT(sasl_clientFirstStep(const TQString &, const TQByteArray *)));
1484
			connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &)));
1484
			connect(d->sasl, TQT_SIGNAL(nextStep(const TQByteArray &)), TQT_SLOT(sasl_nextStep(const TQByteArray &)));
1485
			connect(d->sasl, TQT_SIGNAL(needParams(bool, bool, bool, bool)), TQT_SLOT(sasl_needParams(bool, bool, bool, bool)));
1485
			connect(d->sasl, TQT_SIGNAL(needParams(bool, bool, bool, bool)), TQT_SLOT(sasl_needParams(bool, bool, bool, bool)));
Lines 1557-1569 Link Here
1557
int ClientStream::convertedSASLCond() const
1557
int ClientStream::convertedSASLCond() const
1558
{
1558
{
1559
	int x = d->sasl->errorCondition();
1559
	int x = d->sasl->errorCondition();
1560
	if(x == QCA::SASL::NoMech)
1560
	if(x == TQCA::SASL::NoMech)
1561
		return NoMech;
1561
		return NoMech;
1562
	else if(x == QCA::SASL::BadProto)
1562
	else if(x == TQCA::SASL::BadProto)
1563
		return BadProto;
1563
		return BadProto;
1564
	else if(x == QCA::SASL::BadServ)
1564
	else if(x == TQCA::SASL::BadServ)
1565
		return BadServ;
1565
		return BadServ;
1566
	else if(x == QCA::SASL::TooWeak)
1566
	else if(x == TQCA::SASL::TooWeak)
1567
		return MechTooWeak;
1567
		return MechTooWeak;
1568
	else
1568
	else
1569
		return GenericAuthError;
1569
		return GenericAuthError;
(-)tdenetwork/kopete/protocols/jabber/libiris/iris/xmpp-core/tlshandler.cpp (-17 / +17 lines)
Lines 39-54 Link Here
39
39
40
40
41
//----------------------------------------------------------------------------
41
//----------------------------------------------------------------------------
42
// QCATLSHandler
42
// TQCATLSHandler
43
//----------------------------------------------------------------------------
43
//----------------------------------------------------------------------------
44
class QCATLSHandler::Private
44
class TQCATLSHandler::Private
45
{
45
{
46
public:
46
public:
47
	QCA::TLS *tls;
47
	TQCA::TLS *tls;
48
	int state, err;
48
	int state, err;
49
};
49
};
50
50
51
QCATLSHandler::QCATLSHandler(QCA::TLS *parent)
51
TQCATLSHandler::TQCATLSHandler(TQCA::TLS *parent)
52
:TLSHandler(parent)
52
:TLSHandler(parent)
53
{
53
{
54
	d = new Private;
54
	d = new Private;
Lines 62-89 Link Here
62
	d->err = -1;
62
	d->err = -1;
63
}
63
}
64
64
65
QCATLSHandler::~QCATLSHandler()
65
TQCATLSHandler::~TQCATLSHandler()
66
{
66
{
67
	delete d;
67
	delete d;
68
}
68
}
69
69
70
QCA::TLS *QCATLSHandler::tls() const
70
TQCA::TLS *TQCATLSHandler::tls() const
71
{
71
{
72
	return d->tls;
72
	return d->tls;
73
}
73
}
74
74
75
int QCATLSHandler::tlsError() const
75
int TQCATLSHandler::tlsError() const
76
{
76
{
77
	return d->err;
77
	return d->err;
78
}
78
}
79
79
80
void QCATLSHandler::reset()
80
void TQCATLSHandler::reset()
81
{
81
{
82
	d->tls->reset();
82
	d->tls->reset();
83
	d->state = 0;
83
	d->state = 0;
84
}
84
}
85
85
86
void QCATLSHandler::startClient(const TQString &host)
86
void TQCATLSHandler::startClient(const TQString &host)
87
{
87
{
88
	d->state = 0;
88
	d->state = 0;
89
	d->err = -1;
89
	d->err = -1;
Lines 91-107 Link Here
91
		TQTimer::singleShot(0, this, TQT_SIGNAL(fail()));
91
		TQTimer::singleShot(0, this, TQT_SIGNAL(fail()));
92
}
92
}
93
93
94
void QCATLSHandler::write(const TQByteArray &a)
94
void TQCATLSHandler::write(const TQByteArray &a)
95
{
95
{
96
	d->tls->write(a);
96
	d->tls->write(a);
97
}
97
}
98
98
99
void QCATLSHandler::writeIncoming(const TQByteArray &a)
99
void TQCATLSHandler::writeIncoming(const TQByteArray &a)
100
{
100
{
101
	d->tls->writeIncoming(a);
101
	d->tls->writeIncoming(a);
102
}
102
}
103
103
104
void QCATLSHandler::continueAfterHandshake()
104
void TQCATLSHandler::continueAfterHandshake()
105
{
105
{
106
	if(d->state == 2) {
106
	if(d->state == 2) {
107
		success();
107
		success();
Lines 109-136 Link Here
109
	}
109
	}
110
}
110
}
111
111
112
void QCATLSHandler::tls_handshaken()
112
void TQCATLSHandler::tls_handshaken()
113
{
113
{
114
	d->state = 2;
114
	d->state = 2;
115
	tlsHandshaken();
115
	tlsHandshaken();
116
}
116
}
117
117
118
void QCATLSHandler::tls_readyRead()
118
void TQCATLSHandler::tls_readyRead()
119
{
119
{
120
	readyRead(d->tls->read());
120
	readyRead(d->tls->read());
121
}
121
}
122
122
123
void QCATLSHandler::tls_readyReadOutgoing(int plainBytes)
123
void TQCATLSHandler::tls_readyReadOutgoing(int plainBytes)
124
{
124
{
125
	readyReadOutgoing(d->tls->readOutgoing(), plainBytes);
125
	readyReadOutgoing(d->tls->readOutgoing(), plainBytes);
126
}
126
}
127
127
128
void QCATLSHandler::tls_closed()
128
void TQCATLSHandler::tls_closed()
129
{
129
{
130
	closed();
130
	closed();
131
}
131
}
132
132
133
void QCATLSHandler::tls_error(int x)
133
void TQCATLSHandler::tls_error(int x)
134
{
134
{
135
	d->err = x;
135
	d->err = x;
136
	d->state = 0;
136
	d->state = 0;
(-)tdenetwork/kopete/protocols/jabber/libiris/qca/INSTALL (-1 / +1 lines)
Lines 1-4 Link Here
1
Installing QCA
1
Installing TQCA
2
--------------
2
--------------
3
3
4
Installation should be straightforward:
4
Installation should be straightforward:
(-)tdenetwork/kopete/protocols/jabber/libiris/qca/README (-1 / +1 lines)
Lines 23-29 Link Here
23
And of course, you get a very simple crypto API for Qt, where you can
23
And of course, you get a very simple crypto API for Qt, where you can
24
do things like:
24
do things like:
25
25
26
  QString hash = QCA::SHA1::hashToString(blockOfData);
26
  QString hash = TQCA::SHA1::hashToString(blockOfData);
27
27
28
Have fun!
28
Have fun!
29
29
(-)tdenetwork/kopete/protocols/jabber/libiris/qca/src/qca.cpp (-64 / +64 lines)
Lines 40-51 Link Here
40
#define PLUGIN_EXT "so"
40
#define PLUGIN_EXT "so"
41
#endif
41
#endif
42
42
43
using namespace QCA;
43
using namespace TQCA;
44
44
45
class ProviderItem
45
class ProviderItem
46
{
46
{
47
public:
47
public:
48
	QCAProvider *p;
48
	TQCAProvider *p;
49
	TQString fname;
49
	TQString fname;
50
50
51
	static ProviderItem *load(const TQString &fname)
51
	static ProviderItem *load(const TQString &fname)
Lines 60-67 Link Here
60
			delete lib;
60
			delete lib;
61
			return 0;
61
			return 0;
62
		}
62
		}
63
		QCAProvider *(*createProvider)() = (QCAProvider *(*)())s;
63
		TQCAProvider *(*createProvider)() = (TQCAProvider *(*)())s;
64
		QCAProvider *p = createProvider();
64
		TQCAProvider *p = createProvider();
65
		if(!p) {
65
		if(!p) {
66
			delete lib;
66
			delete lib;
67
			return 0;
67
			return 0;
Lines 71-77 Link Here
71
		return i;
71
		return i;
72
	}
72
	}
73
73
74
	static ProviderItem *fromClass(QCAProvider *p)
74
	static ProviderItem *fromClass(TQCAProvider *p)
75
	{
75
	{
76
		ProviderItem *i = new ProviderItem(0, p);
76
		ProviderItem *i = new ProviderItem(0, p);
77
		return i;
77
		return i;
Lines 95-101 Link Here
95
	TQLibrary *lib;
95
	TQLibrary *lib;
96
	bool init_done;
96
	bool init_done;
97
97
98
	ProviderItem(TQLibrary *_lib, QCAProvider *_p)
98
	ProviderItem(TQLibrary *_lib, TQCAProvider *_p)
99
	{
99
	{
100
		lib = _lib;
100
		lib = _lib;
101
		p = _p;
101
		p = _p;
Lines 142-148 Link Here
142
			ProviderItem *i = ProviderItem::load(fname);
142
			ProviderItem *i = ProviderItem::load(fname);
143
			if(!i)
143
			if(!i)
144
				continue;
144
				continue;
145
			if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) {
145
			if(i->p->qcaVersion() != TQCA_PLUGIN_VERSION) {
146
				delete i;
146
				delete i;
147
				continue;
147
				continue;
148
			}
148
			}
Lines 152-158 Link Here
152
	}
152
	}
153
}
153
}
154
154
155
static void plugin_addClass(QCAProvider *p)
155
static void plugin_addClass(TQCAProvider *p)
156
{
156
{
157
	ProviderItem *i = ProviderItem::fromClass(p);
157
	ProviderItem *i = ProviderItem::fromClass(p);
158
	providerList.prepend(i);
158
	providerList.prepend(i);
Lines 172-178 Link Here
172
	return caps;
172
	return caps;
173
}
173
}
174
174
175
TQString QCA::arrayToHex(const TQByteArray &a)
175
TQString TQCA::arrayToHex(const TQByteArray &a)
176
{
176
{
177
	TQString out;
177
	TQString out;
178
	for(int n = 0; n < (int)a.size(); ++n) {
178
	for(int n = 0; n < (int)a.size(); ++n) {
Lines 183-189 Link Here
183
	return out;
183
	return out;
184
}
184
}
185
185
186
TQByteArray QCA::hexToArray(const TQString &str)
186
TQByteArray TQCA::hexToArray(const TQString &str)
187
{
187
{
188
	TQByteArray out(str.length() / 2);
188
	TQByteArray out(str.length() / 2);
189
	int at = 0;
189
	int at = 0;
Lines 196-202 Link Here
196
	return out;
196
	return out;
197
}
197
}
198
198
199
void QCA::init()
199
void TQCA::init()
200
{
200
{
201
	if(qca_init)
201
	if(qca_init)
202
		return;
202
		return;
Lines 204-210 Link Here
204
	providerList.setAutoDelete(true);
204
	providerList.setAutoDelete(true);
205
}
205
}
206
206
207
bool QCA::isSupported(int capabilities)
207
bool TQCA::isSupported(int capabilities)
208
{
208
{
209
	init();
209
	init();
210
210
Lines 221-232 Link Here
221
	return false;
221
	return false;
222
}
222
}
223
223
224
void QCA::insertProvider(QCAProvider *p)
224
void TQCA::insertProvider(TQCAProvider *p)
225
{
225
{
226
	plugin_addClass(p);
226
	plugin_addClass(p);
227
}
227
}
228
228
229
void QCA::unloadAllPlugins()
229
void TQCA::unloadAllPlugins()
230
{
230
{
231
	plugin_unloadall();
231
	plugin_unloadall();
232
}
232
}
Lines 236-242 Link Here
236
	init();
236
	init();
237
237
238
	// this call will also trip a scan for new plugins if needed
238
	// this call will also trip a scan for new plugins if needed
239
	if(!QCA::isSupported(cap))
239
	if(!TQCA::isSupported(cap))
240
		return 0;
240
		return 0;
241
241
242
	TQPtrListIterator<ProviderItem> it(providerList);
242
	TQPtrListIterator<ProviderItem> it(providerList);
Lines 271-280 Link Here
271
		c->reset();
271
		c->reset();
272
	}
272
	}
273
273
274
	QCA_HashContext *c;
274
	TQCA_HashContext *c;
275
};
275
};
276
276
277
Hash::Hash(QCA_HashContext *c)
277
Hash::Hash(TQCA_HashContext *c)
278
{
278
{
279
	d = new Private;
279
	d = new Private;
280
	d->c = c;
280
	d->c = c;
Lines 340-353 Link Here
340
		err = false;
340
		err = false;
341
	}
341
	}
342
342
343
	QCA_CipherContext *c;
343
	TQCA_CipherContext *c;
344
	int dir;
344
	int dir;
345
	int mode;
345
	int mode;
346
	TQByteArray key, iv;
346
	TQByteArray key, iv;
347
	bool err;
347
	bool err;
348
};
348
};
349
349
350
Cipher::Cipher(QCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
350
Cipher::Cipher(TQCA_CipherContext *c, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
351
{
351
{
352
	d = new Private;
352
	d = new Private;
353
	d->c = c;
353
	d->c = c;
Lines 447-453 Link Here
447
// SHA1
447
// SHA1
448
//----------------------------------------------------------------------------
448
//----------------------------------------------------------------------------
449
SHA1::SHA1()
449
SHA1::SHA1()
450
:Hash((QCA_HashContext *)getContext(CAP_SHA1))
450
:Hash((TQCA_HashContext *)getContext(CAP_SHA1))
451
{
451
{
452
}
452
}
453
453
Lines 456-462 Link Here
456
// SHA256
456
// SHA256
457
//----------------------------------------------------------------------------
457
//----------------------------------------------------------------------------
458
SHA256::SHA256()
458
SHA256::SHA256()
459
:Hash((QCA_HashContext *)getContext(CAP_SHA256))
459
:Hash((TQCA_HashContext *)getContext(CAP_SHA256))
460
{
460
{
461
}
461
}
462
462
Lines 465-471 Link Here
465
// MD5
465
// MD5
466
//----------------------------------------------------------------------------
466
//----------------------------------------------------------------------------
467
MD5::MD5()
467
MD5::MD5()
468
:Hash((QCA_HashContext *)getContext(CAP_MD5))
468
:Hash((TQCA_HashContext *)getContext(CAP_MD5))
469
{
469
{
470
}
470
}
471
471
Lines 474-480 Link Here
474
// BlowFish
474
// BlowFish
475
//----------------------------------------------------------------------------
475
//----------------------------------------------------------------------------
476
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
476
BlowFish::BlowFish(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
477
:Cipher((QCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
477
:Cipher((TQCA_CipherContext *)getContext(CAP_BlowFish), dir, mode, key, iv, pad)
478
{
478
{
479
}
479
}
480
480
Lines 483-489 Link Here
483
// TripleDES
483
// TripleDES
484
//----------------------------------------------------------------------------
484
//----------------------------------------------------------------------------
485
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
485
TripleDES::TripleDES(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
486
:Cipher((QCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
486
:Cipher((TQCA_CipherContext *)getContext(CAP_TripleDES), dir, mode, key, iv, pad)
487
{
487
{
488
}
488
}
489
489
Lines 492-498 Link Here
492
// AES128
492
// AES128
493
//----------------------------------------------------------------------------
493
//----------------------------------------------------------------------------
494
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
494
AES128::AES128(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
495
:Cipher((QCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
495
:Cipher((TQCA_CipherContext *)getContext(CAP_AES128), dir, mode, key, iv, pad)
496
{
496
{
497
}
497
}
498
498
Lines 501-507 Link Here
501
// AES256
501
// AES256
502
//----------------------------------------------------------------------------
502
//----------------------------------------------------------------------------
503
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
503
AES256::AES256(int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad)
504
:Cipher((QCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
504
:Cipher((TQCA_CipherContext *)getContext(CAP_AES256), dir, mode, key, iv, pad)
505
{
505
{
506
}
506
}
507
507
Lines 522-534 Link Here
522
		delete c;
522
		delete c;
523
	}
523
	}
524
524
525
	QCA_RSAKeyContext *c;
525
	TQCA_RSAKeyContext *c;
526
};
526
};
527
527
528
RSAKey::RSAKey()
528
RSAKey::RSAKey()
529
{
529
{
530
	d = new Private;
530
	d = new Private;
531
	d->c = (QCA_RSAKeyContext *)getContext(CAP_RSA);
531
	d->c = (TQCA_RSAKeyContext *)getContext(CAP_RSA);
532
}
532
}
533
533
534
RSAKey::RSAKey(const RSAKey &from)
534
RSAKey::RSAKey(const RSAKey &from)
Lines 685-697 Link Here
685
		delete c;
685
		delete c;
686
	}
686
	}
687
687
688
	QCA_CertContext *c;
688
	TQCA_CertContext *c;
689
};
689
};
690
690
691
Cert::Cert()
691
Cert::Cert()
692
{
692
{
693
	d = new Private;
693
	d = new Private;
694
	d->c = (QCA_CertContext *)getContext(CAP_X509);
694
	d->c = (TQCA_CertContext *)getContext(CAP_X509);
695
}
695
}
696
696
697
Cert::Cert(const Cert &from)
697
Cert::Cert(const Cert &from)
Lines 712-718 Link Here
712
	delete d;
712
	delete d;
713
}
713
}
714
714
715
void Cert::fromContext(QCA_CertContext *ctx)
715
void Cert::fromContext(TQCA_CertContext *ctx)
716
{
716
{
717
	delete d->c;
717
	delete d->c;
718
	d->c = ctx;
718
	d->c = ctx;
Lines 746-763 Link Here
746
746
747
CertProperties Cert::subject() const
747
CertProperties Cert::subject() const
748
{
748
{
749
	TQValueList<QCA_CertProperty> list = d->c->subject();
749
	TQValueList<TQCA_CertProperty> list = d->c->subject();
750
	CertProperties props;
750
	CertProperties props;
751
	for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
751
	for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
752
		props[(*it).var] = (*it).val;
752
		props[(*it).var] = (*it).val;
753
	return props;
753
	return props;
754
}
754
}
755
755
756
CertProperties Cert::issuer() const
756
CertProperties Cert::issuer() const
757
{
757
{
758
	TQValueList<QCA_CertProperty> list = d->c->issuer();
758
	TQValueList<TQCA_CertProperty> list = d->c->issuer();
759
	CertProperties props;
759
	CertProperties props;
760
	for(TQValueList<QCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
760
	for(TQValueList<TQCA_CertProperty>::ConstIterator it = list.begin(); it != list.end(); ++it)
761
		props[(*it).var] = (*it).val;
761
		props[(*it).var] = (*it).val;
762
	return props;
762
	return props;
763
}
763
}
Lines 814-820 Link Here
814
public:
814
public:
815
	Private()
815
	Private()
816
	{
816
	{
817
		c = (QCA_TLSContext *)getContext(CAP_TLS);
817
		c = (TQCA_TLSContext *)getContext(CAP_TLS);
818
	}
818
	}
819
819
820
	~Private()
820
	~Private()
Lines 845-851 Link Here
845
	}
845
	}
846
846
847
	Cert cert;
847
	Cert cert;
848
	QCA_TLSContext *c;
848
	TQCA_TLSContext *c;
849
	TQByteArray in, out, to_net, from_net;
849
	TQByteArray in, out, to_net, from_net;
850
	int bytesEncoded;
850
	int bytesEncoded;
851
	bool tryMore;
851
	bool tryMore;
Lines 856-862 Link Here
856
856
857
	Cert ourCert;
857
	Cert ourCert;
858
	RSAKey ourKey;
858
	RSAKey ourKey;
859
	TQPtrList<QCA_CertContext> store;
859
	TQPtrList<TQCA_CertContext> store;
860
};
860
};
861
861
862
TLS::TLS(TQObject *parent)
862
TLS::TLS(TQObject *parent)
Lines 966-972 Link Here
966
int TLS::certificateValidityResult() const
966
int TLS::certificateValidityResult() const
967
{
967
{
968
	if(d->hostMismatch)
968
	if(d->hostMismatch)
969
		return QCA::TLS::HostMismatch;
969
		return TQCA::TLS::HostMismatch;
970
	else
970
	else
971
		return d->c->validityResult();
971
		return d->c->validityResult();
972
}
972
}
Lines 982-993 Link Here
982
		TQByteArray a;
982
		TQByteArray a;
983
		int r = d->c->shutdown(d->from_net, &a);
983
		int r = d->c->shutdown(d->from_net, &a);
984
		d->from_net.resize(0);
984
		d->from_net.resize(0);
985
		if(r == QCA_TLSContext::Error) {
985
		if(r == TQCA_TLSContext::Error) {
986
			reset();
986
			reset();
987
			error(ErrHandshake);
987
			error(ErrHandshake);
988
			return;
988
			return;
989
		}
989
		}
990
		if(r == QCA_TLSContext::Success) {
990
		if(r == TQCA_TLSContext::Success) {
991
			d->from_net = d->c->unprocessed().copy();
991
			d->from_net = d->c->unprocessed().copy();
992
			done = true;
992
			done = true;
993
		}
993
		}
Lines 998-1012 Link Here
998
			TQByteArray a;
998
			TQByteArray a;
999
			int r = d->c->handshake(d->from_net, &a);
999
			int r = d->c->handshake(d->from_net, &a);
1000
			d->from_net.resize(0);
1000
			d->from_net.resize(0);
1001
			if(r == QCA_TLSContext::Error) {
1001
			if(r == TQCA_TLSContext::Error) {
1002
				reset();
1002
				reset();
1003
				error(ErrHandshake);
1003
				error(ErrHandshake);
1004
				return;
1004
				return;
1005
			}
1005
			}
1006
			d->appendArray(&d->to_net, a);
1006
			d->appendArray(&d->to_net, a);
1007
			if(r == QCA_TLSContext::Success) {
1007
			if(r == TQCA_TLSContext::Success) {
1008
				QCA_CertContext *cc = d->c->peerCertificate();
1008
				TQCA_CertContext *cc = d->c->peerCertificate();
1009
				if(cc && !d->host.isEmpty() && d->c->validityResult() == QCA::TLS::Valid) {
1009
				if(cc && !d->host.isEmpty() && d->c->validityResult() == TQCA::TLS::Valid) {
1010
					if(!cc->matchesAddress(d->host))
1010
					if(!cc->matchesAddress(d->host))
1011
						d->hostMismatch = true;
1011
						d->hostMismatch = true;
1012
				}
1012
				}
Lines 1097-1103 Link Here
1097
public:
1097
public:
1098
	Private()
1098
	Private()
1099
	{
1099
	{
1100
		c = (QCA_SASLContext *)getContext(CAP_SASL);
1100
		c = (TQCA_SASLContext *)getContext(CAP_SASL);
1101
	}
1101
	}
1102
1102
1103
	~Private()
1103
	~Private()
Lines 1117-1123 Link Here
1117
	int ext_ssf;
1117
	int ext_ssf;
1118
1118
1119
	bool tried;
1119
	bool tried;
1120
	QCA_SASLContext *c;
1120
	TQCA_SASLContext *c;
1121
	TQHostAddress localAddr, remoteAddr;
1121
	TQHostAddress localAddr, remoteAddr;
1122
	int localPort, remotePort;
1122
	int localPort, remotePort;
1123
	TQByteArray stepData;
1123
	TQByteArray stepData;
Lines 1241-1247 Link Here
1241
1241
1242
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
1242
bool SASL::startClient(const TQString &service, const TQString &host, const TQStringList &mechlist, bool allowClientSendFirst)
1243
{
1243
{
1244
	QCA_SASLHostPort la, ra;
1244
	TQCA_SASLHostPort la, ra;
1245
	if(d->localPort != -1) {
1245
	if(d->localPort != -1) {
1246
		la.addr = d->localAddr;
1246
		la.addr = d->localAddr;
1247
		la.port = d->localPort;
1247
		la.port = d->localPort;
Lines 1266-1272 Link Here
1266
1266
1267
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
1267
bool SASL::startServer(const TQString &service, const TQString &host, const TQString &realm, TQStringList *mechlist)
1268
{
1268
{
1269
	QCA_SASLHostPort la, ra;
1269
	TQCA_SASLHostPort la, ra;
1270
	if(d->localPort != -1) {
1270
	if(d->localPort != -1) {
1271
		la.addr = d->localAddr;
1271
		la.addr = d->localAddr;
1272
		la.port = d->localPort;
1272
		la.port = d->localPort;
Lines 1301-1311 Link Here
1301
1301
1302
void SASL::handleServerFirstStep(int r)
1302
void SASL::handleServerFirstStep(int r)
1303
{
1303
{
1304
	if(r == QCA_SASLContext::Success)
1304
	if(r == TQCA_SASLContext::Success)
1305
		authenticated();
1305
		authenticated();
1306
	else if(r == QCA_SASLContext::Continue)
1306
	else if(r == TQCA_SASLContext::Continue)
1307
		nextStep(d->c->result());
1307
		nextStep(d->c->result());
1308
	else if(r == QCA_SASLContext::AuthCheck)
1308
	else if(r == TQCA_SASLContext::AuthCheck)
1309
		tryAgain();
1309
		tryAgain();
1310
	else
1310
	else
1311
		error(ErrAuth);
1311
		error(ErrAuth);
Lines 1360-1375 Link Here
1360
			r = d->c->tryAgain();
1360
			r = d->c->tryAgain();
1361
		}
1361
		}
1362
1362
1363
		if(r == QCA_SASLContext::Error) {
1363
		if(r == TQCA_SASLContext::Error) {
1364
			error(ErrAuth);
1364
			error(ErrAuth);
1365
			return;
1365
			return;
1366
		}
1366
		}
1367
		else if(r == QCA_SASLContext::Continue) {
1367
		else if(r == TQCA_SASLContext::Continue) {
1368
			d->tried = false;
1368
			d->tried = false;
1369
			nextStep(d->c->result());
1369
			nextStep(d->c->result());
1370
			return;
1370
			return;
1371
		}
1371
		}
1372
		else if(r == QCA_SASLContext::AuthCheck) {
1372
		else if(r == TQCA_SASLContext::AuthCheck) {
1373
			authCheck(d->c->username(), d->c->authzid());
1373
			authCheck(d->c->username(), d->c->authzid());
1374
			return;
1374
			return;
1375
		}
1375
		}
Lines 1383-1395 Link Here
1383
			else
1383
			else
1384
				r = d->c->tryAgain();
1384
				r = d->c->tryAgain();
1385
1385
1386
			if(r == QCA_SASLContext::Error) {
1386
			if(r == TQCA_SASLContext::Error) {
1387
				error(ErrAuth);
1387
				error(ErrAuth);
1388
				return;
1388
				return;
1389
			}
1389
			}
1390
			else if(r == QCA_SASLContext::NeedParams) {
1390
			else if(r == TQCA_SASLContext::NeedParams) {
1391
				//d->tried = false;
1391
				//d->tried = false;
1392
				QCA_SASLNeedParams np = d->c->clientParamsNeeded();
1392
				TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
1393
				needParams(np.user, np.authzid, np.pass, np.realm);
1393
				needParams(np.user, np.authzid, np.pass, np.realm);
1394
				return;
1394
				return;
1395
			}
1395
			}
Lines 1409-1435 Link Here
1409
			else
1409
			else
1410
				r = d->c->tryAgain();
1410
				r = d->c->tryAgain();
1411
1411
1412
			if(r == QCA_SASLContext::Error) {
1412
			if(r == TQCA_SASLContext::Error) {
1413
				error(ErrAuth);
1413
				error(ErrAuth);
1414
				return;
1414
				return;
1415
			}
1415
			}
1416
			else if(r == QCA_SASLContext::NeedParams) {
1416
			else if(r == TQCA_SASLContext::NeedParams) {
1417
				//d->tried = false;
1417
				//d->tried = false;
1418
				QCA_SASLNeedParams np = d->c->clientParamsNeeded();
1418
				TQCA_SASLNeedParams np = d->c->clientParamsNeeded();
1419
				needParams(np.user, np.authzid, np.pass, np.realm);
1419
				needParams(np.user, np.authzid, np.pass, np.realm);
1420
				return;
1420
				return;
1421
			}
1421
			}
1422
			d->tried = false;
1422
			d->tried = false;
1423
			//else if(r == QCA_SASLContext::Continue) {
1423
			//else if(r == TQCA_SASLContext::Continue) {
1424
				nextStep(d->c->result());
1424
				nextStep(d->c->result());
1425
			//	return;
1425
			//	return;
1426
			//}
1426
			//}
1427
		}
1427
		}
1428
	}
1428
	}
1429
1429
1430
	if(r == QCA_SASLContext::Success)
1430
	if(r == TQCA_SASLContext::Success)
1431
		authenticated();
1431
		authenticated();
1432
	else if(r == QCA_SASLContext::Error)
1432
	else if(r == TQCA_SASLContext::Error)
1433
		error(ErrAuth);
1433
		error(ErrAuth);
1434
}
1434
}
1435
1435
(-)tdenetwork/kopete/protocols/jabber/libiris/qca/src/qca.h (-43 / +43 lines)
Lines 18-25 Link Here
18
 *
18
 *
19
 */
19
 */
20
20
21
#ifndef QCA_H
21
#ifndef TQCA_H
22
#define QCA_H
22
#define TQCA_H
23
23
24
#include<tqstring.h>
24
#include<tqstring.h>
25
#include<tqcstring.h>
25
#include<tqcstring.h>
Lines 29-66 Link Here
29
#include<tqobject.h>
29
#include<tqobject.h>
30
30
31
#ifdef Q_OS_WIN32
31
#ifdef Q_OS_WIN32
32
#  ifndef QCA_STATIC
32
#  ifndef TQCA_STATIC
33
#    ifdef QCA_MAKEDLL
33
#    ifdef TQCA_MAKEDLL
34
#      define QCA_EXPORT __declspec(dllexport)
34
#      define TQCA_EXPORT __declspec(dllexport)
35
#    else
35
#    else
36
#      define QCA_EXPORT __declspec(dllimport)
36
#      define TQCA_EXPORT __declspec(dllimport)
37
#    endif
37
#    endif
38
#  endif
38
#  endif
39
#endif
39
#endif
40
#ifndef QCA_EXPORT
40
#ifndef TQCA_EXPORT
41
#define QCA_EXPORT
41
#define TQCA_EXPORT
42
#endif
42
#endif
43
43
44
#ifdef Q_OS_WIN32
44
#ifdef Q_OS_WIN32
45
#  ifdef QCA_PLUGIN_DLL
45
#  ifdef TQCA_PLUGIN_DLL
46
#    define QCA_PLUGIN_EXPORT extern "C" __declspec(dllexport)
46
#    define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllexport)
47
#  else
47
#  else
48
#    define QCA_PLUGIN_EXPORT extern "C" __declspec(dllimport)
48
#    define TQCA_PLUGIN_EXPORT extern "C" __declspec(dllimport)
49
#  endif
49
#  endif
50
#endif
50
#endif
51
#ifndef QCA_PLUGIN_EXPORT
51
#ifndef TQCA_PLUGIN_EXPORT
52
#define QCA_PLUGIN_EXPORT extern "C"
52
#define TQCA_PLUGIN_EXPORT extern "C"
53
#endif
53
#endif
54
54
55
class TQHostAddress;
55
class TQHostAddress;
56
class TQStringList;
56
class TQStringList;
57
57
58
class QCAProvider;
58
class TQCAProvider;
59
class QCA_HashContext;
59
class TQCA_HashContext;
60
class QCA_CipherContext;
60
class TQCA_CipherContext;
61
class QCA_CertContext;
61
class TQCA_CertContext;
62
62
63
namespace QCA
63
namespace TQCA
64
{
64
{
65
	enum {
65
	enum {
66
		CAP_SHA1      = 0x0001,
66
		CAP_SHA1      = 0x0001,
Lines 86-100 Link Here
86
		Decrypt = 0x0002
86
		Decrypt = 0x0002
87
	};
87
	};
88
88
89
	QCA_EXPORT void init();
89
	TQCA_EXPORT void init();
90
	QCA_EXPORT bool isSupported(int capabilities);
90
	TQCA_EXPORT bool isSupported(int capabilities);
91
	QCA_EXPORT void insertProvider(QCAProvider *);
91
	TQCA_EXPORT void insertProvider(TQCAProvider *);
92
	QCA_EXPORT void unloadAllPlugins();
92
	TQCA_EXPORT void unloadAllPlugins();
93
93
94
	QCA_EXPORT TQString arrayToHex(const TQByteArray &);
94
	TQCA_EXPORT TQString arrayToHex(const TQByteArray &);
95
	QCA_EXPORT TQByteArray hexToArray(const TQString &);
95
	TQCA_EXPORT TQByteArray hexToArray(const TQString &);
96
96
97
	class QCA_EXPORT Hash
97
	class TQCA_EXPORT Hash
98
	{
98
	{
99
	public:
99
	public:
100
		Hash(const Hash &);
100
		Hash(const Hash &);
Lines 106-112 Link Here
106
		TQByteArray final();
106
		TQByteArray final();
107
107
108
	protected:
108
	protected:
109
		Hash(QCA_HashContext *);
109
		Hash(TQCA_HashContext *);
110
110
111
	private:
111
	private:
112
		class Private;
112
		class Private;
Lines 114-120 Link Here
114
	};
114
	};
115
115
116
	template <class T>
116
	template <class T>
117
	class QCA_EXPORT HashStatic
117
	class TQCA_EXPORT HashStatic
118
	{
118
	{
119
	public:
119
	public:
120
		HashStatic<T>() {}
120
		HashStatic<T>() {}
Lines 144-150 Link Here
144
		}
144
		}
145
	};
145
	};
146
146
147
	class QCA_EXPORT Cipher
147
	class TQCA_EXPORT Cipher
148
	{
148
	{
149
	public:
149
	public:
150
		Cipher(const Cipher &);
150
		Cipher(const Cipher &);
Lines 158-164 Link Here
158
		TQByteArray final(bool *ok=0);
158
		TQByteArray final(bool *ok=0);
159
159
160
	protected:
160
	protected:
161
		Cipher(QCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad);
161
		Cipher(TQCA_CipherContext *, int dir, int mode, const TQByteArray &key, const TQByteArray &iv, bool pad);
162
162
163
	private:
163
	private:
164
		class Private;
164
		class Private;
Lines 166-172 Link Here
166
	};
166
	};
167
167
168
	template <class T>
168
	template <class T>
169
	class QCA_EXPORT CipherStatic
169
	class TQCA_EXPORT CipherStatic
170
	{
170
	{
171
	public:
171
	public:
172
		CipherStatic<T>() {}
172
		CipherStatic<T>() {}
Lines 184-233 Link Here
184
		}
184
		}
185
	};
185
	};
186
186
187
	class QCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1>
187
	class TQCA_EXPORT SHA1 : public Hash, public HashStatic<SHA1>
188
	{
188
	{
189
	public:
189
	public:
190
		SHA1();
190
		SHA1();
191
	};
191
	};
192
192
193
	class QCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256>
193
	class TQCA_EXPORT SHA256 : public Hash, public HashStatic<SHA256>
194
	{
194
	{
195
	public:
195
	public:
196
		SHA256();
196
		SHA256();
197
	};
197
	};
198
198
199
	class QCA_EXPORT MD5 : public Hash, public HashStatic<MD5>
199
	class TQCA_EXPORT MD5 : public Hash, public HashStatic<MD5>
200
	{
200
	{
201
	public:
201
	public:
202
		MD5();
202
		MD5();
203
	};
203
	};
204
204
205
	class QCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish>
205
	class TQCA_EXPORT BlowFish : public Cipher, public CipherStatic<BlowFish>
206
	{
206
	{
207
	public:
207
	public:
208
		BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
208
		BlowFish(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
209
	};
209
	};
210
210
211
	class QCA_EXPORT TripleDES : public Cipher, public CipherStatic<TripleDES>
211
	class TQCA_EXPORT TripleDES : public Cipher, public CipherStatic<TripleDES>
212
	{
212
	{
213
	public:
213
	public:
214
		TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
214
		TripleDES(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
215
	};
215
	};
216
216
217
	class QCA_EXPORT AES128 : public Cipher, public CipherStatic<AES128>
217
	class TQCA_EXPORT AES128 : public Cipher, public CipherStatic<AES128>
218
	{
218
	{
219
	public:
219
	public:
220
		AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
220
		AES128(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
221
	};
221
	};
222
222
223
	class QCA_EXPORT AES256 : public Cipher, public CipherStatic<AES256>
223
	class TQCA_EXPORT AES256 : public Cipher, public CipherStatic<AES256>
224
	{
224
	{
225
	public:
225
	public:
226
		AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
226
		AES256(int dir=Encrypt, int mode=CBC, const TQByteArray &key=TQByteArray(), const TQByteArray &iv=TQByteArray(), bool pad=true);
227
	};
227
	};
228
228
229
	class RSA;
229
	class RSA;
230
	class QCA_EXPORT RSAKey
230
	class TQCA_EXPORT RSAKey
231
	{
231
	{
232
	public:
232
	public:
233
		RSAKey();
233
		RSAKey();
Lines 259-265 Link Here
259
		bool generate(unsigned int bits);
259
		bool generate(unsigned int bits);
260
	};
260
	};
261
261
262
	class QCA_EXPORT RSA
262
	class TQCA_EXPORT RSA
263
	{
263
	{
264
	public:
264
	public:
265
		RSA();
265
		RSA();
Lines 278-284 Link Here
278
	};
278
	};
279
279
280
	typedef TQMap<TQString, TQString> CertProperties;
280
	typedef TQMap<TQString, TQString> CertProperties;
281
	class QCA_EXPORT Cert
281
	class TQCA_EXPORT Cert
282
	{
282
	{
283
	public:
283
	public:
284
		Cert();
284
		Cert();
Lines 308-317 Link Here
308
		Private *d;
308
		Private *d;
309
309
310
		friend class TLS;
310
		friend class TLS;
311
		void fromContext(QCA_CertContext *);
311
		void fromContext(TQCA_CertContext *);
312
	};
312
	};
313
313
314
	class QCA_EXPORT TLS : public TQObject
314
	class TQCA_EXPORT TLS : public TQObject
315
	{
315
	{
316
		Q_OBJECT
316
		Q_OBJECT
317
  
317
  
Lines 373-379 Link Here
373
		Private *d;
373
		Private *d;
374
	};
374
	};
375
375
376
	class QCA_EXPORT SASL : public TQObject
376
	class TQCA_EXPORT SASL : public TQObject
377
	{
377
	{
378
		Q_OBJECT
378
		Q_OBJECT
379
  
379
  
(-)tdenetwork/kopete/protocols/jabber/libiris/qca/src/qcaprovider.h (-33 / +33 lines)
Lines 1-5 Link Here
1
/*
1
/*
2
 * qcaprovider.h - QCA Plugin API
2
 * qcaprovider.h - TQCA Plugin API
3
 * Copyright (C) 2003  Justin Karneges
3
 * Copyright (C) 2003  Justin Karneges
4
 *
4
 *
5
 * This library is free software; you can redistribute it and/or
5
 * This library is free software; you can redistribute it and/or
Lines 18-25 Link Here
18
 *
18
 *
19
 */
19
 */
20
20
21
#ifndef QCAPROVIDER_H
21
#ifndef TQCAPROVIDER_H
22
#define QCAPROVIDER_H
22
#define TQCAPROVIDER_H
23
23
24
#include<tqglobal.h>
24
#include<tqglobal.h>
25
#include<tqstring.h>
25
#include<tqstring.h>
Lines 28-40 Link Here
28
#include<tqhostaddress.h>
28
#include<tqhostaddress.h>
29
#include"qca.h"
29
#include"qca.h"
30
30
31
#define QCA_PLUGIN_VERSION 1
31
#define TQCA_PLUGIN_VERSION 1
32
32
33
class QCAProvider
33
class TQCAProvider
34
{
34
{
35
public:
35
public:
36
	QCAProvider() {}
36
	TQCAProvider() {}
37
	virtual ~QCAProvider() {}
37
	virtual ~TQCAProvider() {}
38
38
39
	virtual void init()=0;
39
	virtual void init()=0;
40
	virtual int qcaVersion() const=0;
40
	virtual int qcaVersion() const=0;
Lines 42-64 Link Here
42
	virtual void *context(int cap)=0;
42
	virtual void *context(int cap)=0;
43
};
43
};
44
44
45
class QCA_HashContext
45
class TQCA_HashContext
46
{
46
{
47
public:
47
public:
48
	virtual ~QCA_HashContext() {}
48
	virtual ~TQCA_HashContext() {}
49
49
50
	virtual QCA_HashContext *clone()=0;
50
	virtual TQCA_HashContext *clone()=0;
51
	virtual void reset()=0;
51
	virtual void reset()=0;
52
	virtual void update(const char *in, unsigned int len)=0;
52
	virtual void update(const char *in, unsigned int len)=0;
53
	virtual void final(TQByteArray *out)=0;
53
	virtual void final(TQByteArray *out)=0;
54
};
54
};
55
55
56
class QCA_CipherContext
56
class TQCA_CipherContext
57
{
57
{
58
public:
58
public:
59
	virtual ~QCA_CipherContext() {}
59
	virtual ~TQCA_CipherContext() {}
60
60
61
	virtual QCA_CipherContext *clone()=0;
61
	virtual TQCA_CipherContext *clone()=0;
62
	virtual int keySize()=0;
62
	virtual int keySize()=0;
63
	virtual int blockSize()=0;
63
	virtual int blockSize()=0;
64
	virtual bool generateKey(char *out, int keysize=-1)=0;
64
	virtual bool generateKey(char *out, int keysize=-1)=0;
Lines 69-80 Link Here
69
	virtual bool final(TQByteArray *out)=0;
69
	virtual bool final(TQByteArray *out)=0;
70
};
70
};
71
71
72
class QCA_RSAKeyContext
72
class TQCA_RSAKeyContext
73
{
73
{
74
public:
74
public:
75
	virtual ~QCA_RSAKeyContext() {}
75
	virtual ~TQCA_RSAKeyContext() {}
76
76
77
	virtual QCA_RSAKeyContext *clone() const=0;
77
	virtual TQCA_RSAKeyContext *clone() const=0;
78
	virtual bool isNull() const=0;
78
	virtual bool isNull() const=0;
79
	virtual bool havePublic() const=0;
79
	virtual bool havePublic() const=0;
80
	virtual bool havePrivate() const=0;
80
	virtual bool havePrivate() const=0;
Lines 89-106 Link Here
89
	virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
89
	virtual bool decrypt(const TQByteArray &in, TQByteArray *out, bool oaep)=0;
90
};
90
};
91
91
92
struct QCA_CertProperty
92
struct TQCA_CertProperty
93
{
93
{
94
	TQString var;
94
	TQString var;
95
	TQString val;
95
	TQString val;
96
};
96
};
97
97
98
class QCA_CertContext
98
class TQCA_CertContext
99
{
99
{
100
public:
100
public:
101
	virtual ~QCA_CertContext() {}
101
	virtual ~TQCA_CertContext() {}
102
102
103
	virtual QCA_CertContext *clone() const=0;
103
	virtual TQCA_CertContext *clone() const=0;
104
	virtual bool isNull() const=0;
104
	virtual bool isNull() const=0;
105
	virtual bool createFromDER(const char *in, unsigned int len)=0;
105
	virtual bool createFromDER(const char *in, unsigned int len)=0;
106
	virtual bool createFromPEM(const char *in, unsigned int len)=0;
106
	virtual bool createFromPEM(const char *in, unsigned int len)=0;
Lines 110-131 Link Here
110
	virtual TQString serialNumber() const=0;
110
	virtual TQString serialNumber() const=0;
111
	virtual TQString subjectString() const=0;
111
	virtual TQString subjectString() const=0;
112
	virtual TQString issuerString() const=0;
112
	virtual TQString issuerString() const=0;
113
	virtual TQValueList<QCA_CertProperty> subject() const=0;
113
	virtual TQValueList<TQCA_CertProperty> subject() const=0;
114
	virtual TQValueList<QCA_CertProperty> issuer() const=0;
114
	virtual TQValueList<TQCA_CertProperty> issuer() const=0;
115
	virtual TQDateTime notBefore() const=0;
115
	virtual TQDateTime notBefore() const=0;
116
	virtual TQDateTime notAfter() const=0;
116
	virtual TQDateTime notAfter() const=0;
117
	virtual bool matchesAddress(const TQString &realHost) const=0;
117
	virtual bool matchesAddress(const TQString &realHost) const=0;
118
};
118
};
119
119
120
class QCA_TLSContext
120
class TQCA_TLSContext
121
{
121
{
122
public:
122
public:
123
	enum Result { Success, Error, Continue };
123
	enum Result { Success, Error, Continue };
124
	virtual ~QCA_TLSContext() {}
124
	virtual ~TQCA_TLSContext() {}
125
125
126
	virtual void reset()=0;
126
	virtual void reset()=0;
127
	virtual bool startClient(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
127
	virtual bool startClient(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
128
	virtual bool startServer(const TQPtrList<QCA_CertContext> &store, const QCA_CertContext &cert, const QCA_RSAKeyContext &key)=0;
128
	virtual bool startServer(const TQPtrList<TQCA_CertContext> &store, const TQCA_CertContext &cert, const TQCA_RSAKeyContext &key)=0;
129
129
130
	virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
130
	virtual int handshake(const TQByteArray &in, TQByteArray *out)=0;
131
	virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
131
	virtual int shutdown(const TQByteArray &in, TQByteArray *out)=0;
Lines 134-163 Link Here
134
	virtual bool eof() const=0;
134
	virtual bool eof() const=0;
135
	virtual TQByteArray unprocessed()=0;
135
	virtual TQByteArray unprocessed()=0;
136
136
137
	virtual QCA_CertContext *peerCertificate() const=0;
137
	virtual TQCA_CertContext *peerCertificate() const=0;
138
	virtual int validityResult() const=0;
138
	virtual int validityResult() const=0;
139
};
139
};
140
140
141
struct QCA_SASLHostPort
141
struct TQCA_SASLHostPort
142
{
142
{
143
	TQHostAddress addr;
143
	TQHostAddress addr;
144
	TQ_UINT16 port;
144
	TQ_UINT16 port;
145
};
145
};
146
146
147
struct QCA_SASLNeedParams
147
struct TQCA_SASLNeedParams
148
{
148
{
149
	bool user, authzid, pass, realm;
149
	bool user, authzid, pass, realm;
150
};
150
};
151
151
152
class QCA_SASLContext
152
class TQCA_SASLContext
153
{
153
{
154
public:
154
public:
155
	enum Result { Success, Error, NeedParams, AuthCheck, Continue };
155
	enum Result { Success, Error, NeedParams, AuthCheck, Continue };
156
	virtual ~QCA_SASLContext() {}
156
	virtual ~TQCA_SASLContext() {}
157
157
158
	// common
158
	// common
159
	virtual void reset()=0;
159
	virtual void reset()=0;
160
	virtual void setCoreProps(const TQString &service, const TQString &host, QCA_SASLHostPort *local, QCA_SASLHostPort *remote)=0;
160
	virtual void setCoreProps(const TQString &service, const TQString &host, TQCA_SASLHostPort *local, TQCA_SASLHostPort *remote)=0;
161
	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;
161
	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;
162
	virtual int security() const=0;
162
	virtual int security() const=0;
163
	virtual int errorCond() const=0;
163
	virtual int errorCond() const=0;
Lines 169-175 Link Here
169
	virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
169
	virtual int serverFirstStep(const TQString &mech, const TQByteArray *in)=0;
170
170
171
	// get / set params
171
	// get / set params
172
	virtual QCA_SASLNeedParams clientParamsNeeded() const=0;
172
	virtual TQCA_SASLNeedParams clientParamsNeeded() const=0;
173
	virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
173
	virtual void setClientParams(const TQString *user, const TQString *authzid, const TQString *pass, const TQString *realm)=0;
174
	virtual TQString username() const=0;
174
	virtual TQString username() const=0;
175
	virtual TQString authzid() const=0;
175
	virtual TQString authzid() const=0;
(-)tdenetwork/kopete/protocols/jabber/ui/jabberregisteraccount.cpp (-1 / +1 lines)
Lines 264-270 Link Here
264
		case JabberClient::NoTLS:
264
		case JabberClient::NoTLS:
265
			// no SSL support, at the connecting stage this means the problem is client-side
265
			// no SSL support, at the connecting stage this means the problem is client-side
266
			KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
266
			KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
267
								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.").
267
								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.").
268
								arg ( mMainWidget->leJID->text () ),
268
								arg ( mMainWidget->leJID->text () ),
269
								i18n ("Jabber SSL Error"));
269
								i18n ("Jabber SSL Error"));
270
			break;
270
			break;

Return to bug 1040