summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-20 21:14:01 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-20 21:25:03 (GMT)
commitc84fb752cc881dfca9727b69fcdb3230830b7cc4 (patch)
treeede286a20ccf8daf109f2d1b03c610d6d97f9b8a /Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
parent8149107ade43f9c9fff8fe134f1bce5b5e8b2234 (diff)
downloadswift-c84fb752cc881dfca9727b69fcdb3230830b7cc4.zip
swift-c84fb752cc881dfca9727b69fcdb3230830b7cc4.tar.bz2
Abstracting authenticators.
Diffstat (limited to 'Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp')
-rw-r--r--Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
index b2e85e9..3109f56 100644
--- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
+++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp
@@ -7,16 +7,16 @@
namespace Swift {
-SCRAMSHA1ClientAuthenticator::SCRAMSHA1ClientAuthenticator(const String& authcid, const String& password, const String& authzid, const ByteArray& nonce) : step(Initial), authcid(authcid), password(password), authzid(authzid), clientnonce(nonce) {
+SCRAMSHA1ClientAuthenticator::SCRAMSHA1ClientAuthenticator(const ByteArray& nonce) : ClientAuthenticator("SCRAM-SHA1"), step(Initial), clientnonce(nonce) {
}
-ByteArray SCRAMSHA1ClientAuthenticator::getMessage() const {
+ByteArray SCRAMSHA1ClientAuthenticator::getResponse() const {
if (step == Initial) {
return getInitialClientMessage();
}
else {
ByteArray mask = HMACSHA1::getResult(getClientVerifier(), initialServerMessage + getInitialClientMessage());
- ByteArray p = SHA1::getBinaryHash(password);
+ ByteArray p = SHA1::getBinaryHash(getPassword());
for (unsigned int i = 0; i < p.getSize(); ++i) {
p[i] ^= mask[i];
}
@@ -24,7 +24,7 @@ ByteArray SCRAMSHA1ClientAuthenticator::getMessage() const {
}
}
-bool SCRAMSHA1ClientAuthenticator::setResponse(const ByteArray& response) {
+bool SCRAMSHA1ClientAuthenticator::setChallenge(const ByteArray& response) {
if (step == Initial) {
initialServerMessage = response;
step = Proof;
@@ -46,11 +46,11 @@ ByteArray SCRAMSHA1ClientAuthenticator::getSalt() const {
}
ByteArray SCRAMSHA1ClientAuthenticator::getClientVerifier() const {
- return HMACSHA1::getResult(SHA1::getBinaryHash(password), getSalt());
+ return HMACSHA1::getResult(SHA1::getBinaryHash(getPassword()), getSalt());
}
ByteArray SCRAMSHA1ClientAuthenticator::getInitialClientMessage() const {
- return ByteArray(authzid) + '\0' + ByteArray(authcid) + '\0' + ByteArray(clientnonce);
+ return ByteArray(getAuthorizationID()) + '\0' + ByteArray(getAuthenticationID()) + '\0' + ByteArray(clientnonce);
}
}