summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-22 12:48:10 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-22 12:48:10 (GMT)
commit077d9f1f83c3a7ad819fea43e6c7beeefaaf81c7 (patch)
tree04407db3881c2a34261afb675eaa1d6d74d6daa7 /Swiften/SASL/UnitTest
parent14fbc9a52ffad2573e1955f09b033c714b9f2ff4 (diff)
downloadswift-contrib-077d9f1f83c3a7ad819fea43e6c7beeefaaf81c7.zip
swift-contrib-077d9f1f83c3a7ad819fea43e6c7beeefaaf81c7.tar.bz2
Added SCRAM-SHA-1 test for initial server challenge.
Diffstat (limited to 'Swiften/SASL/UnitTest')
-rw-r--r--Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp b/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp
index 618a748..01adc18 100644
--- a/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp
+++ b/Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp
@@ -11,6 +11,9 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testGetInitialResponse);
CPPUNIT_TEST(testGetInitialResponse_UsernameHasSpecialChars);
CPPUNIT_TEST(testGetFinalResponse);
+ CPPUNIT_TEST(testSetChallenge);
+ CPPUNIT_TEST(testSetChallenge_InvalidClientNonce);
+ CPPUNIT_TEST(testSetChallenge_OnlyClientNonce);
CPPUNIT_TEST(testSetFinalChallenge);
CPPUNIT_TEST(testSetFinalChallenge_InvalidChallenge);
CPPUNIT_TEST_SUITE_END();
@@ -56,6 +59,33 @@ class SCRAMSHA1ClientAuthenticatorTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(result);
}
+ void testSetChallenge() {
+ SCRAMSHA1ClientAuthenticator testling("abcdefgh");
+ testling.setCredentials("user", "pass", "");
+
+ bool result = testling.setChallenge(ByteArray("r=abcdefghABCDEFGH,s=MTIzNDU2NzgK,i=4096"));
+
+ CPPUNIT_ASSERT(result);
+ }
+
+ void testSetChallenge_InvalidClientNonce() {
+ SCRAMSHA1ClientAuthenticator testling("abcdefgh");
+ testling.setCredentials("user", "pass", "");
+
+ bool result = testling.setChallenge(ByteArray("r=abcdefgiABCDEFGH,s=MTIzNDU2NzgK,i=4096"));
+
+ CPPUNIT_ASSERT(!result);
+ }
+
+ void testSetChallenge_OnlyClientNonce() {
+ SCRAMSHA1ClientAuthenticator testling("abcdefgh");
+ testling.setCredentials("user", "pass", "");
+
+ bool result = testling.setChallenge(ByteArray("r=abcdefgh,s=MTIzNDU2NzgK,i=4096"));
+
+ CPPUNIT_ASSERT(!result);
+ }
+
void testSetFinalChallenge_InvalidChallenge() {
SCRAMSHA1ClientAuthenticator testling("abcdefgh");
testling.setCredentials("user", "pass", "");