summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-03 20:39:27 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-05 19:43:14 (GMT)
commit772b2ec0243d7b55d91e4027d828881d18093ed0 (patch)
tree83a58b2b97f3992165ee20c05e0630452eb50457 /Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp
parent0b3db8fd68abee7269d5a38aabd8a816e099eae5 (diff)
downloadswift-772b2ec0243d7b55d91e4027d828881d18093ed0.zip
swift-772b2ec0243d7b55d91e4027d828881d18093ed0.tar.bz2
Replace ByteArray by typedef.
Diffstat (limited to 'Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp')
-rw-r--r--Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp
index 853609f..3ff0893 100644
--- a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp
+++ b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp
@@ -10,6 +10,8 @@
#include <Swiften/StringCodecs/MD5.h>
#include <Swiften/StringCodecs/Hexify.h>
+#include <Swiften/Base/Concat.h>
+#include <Swiften/Base/Algorithm.h>
namespace Swift {
@@ -30,16 +32,18 @@ boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const {
std::string nc = "00000001";
// Compute the response value
- ByteArray A1 = MD5::getHash(getAuthenticationID() + ":" + realm + ":" + getPassword()) + ":" + *challenge.getValue("nonce") + ":" + cnonce;
+ ByteArray A1 = concat(
+ MD5::getHash(createByteArray(getAuthenticationID() + ":" + realm + ":" + getPassword())), createByteArray(":"), createByteArray(*challenge.getValue("nonce")), createByteArray(":"), createByteArray(cnonce));
if (!getAuthorizationID().empty()) {
- A1 += ":" + getAuthenticationID();
+ append(A1, createByteArray(":" + getAuthenticationID()));
}
- std::string A2 = "AUTHENTICATE:" + digestURI;
+ ByteArray A2 = createByteArray("AUTHENTICATE:" + digestURI);
+
+ std::string responseValue = Hexify::hexify(MD5::getHash(createByteArray(
+ Hexify::hexify(MD5::getHash(A1)) + ":"
+ + *challenge.getValue("nonce") + ":" + nc + ":" + cnonce + ":" + qop + ":"
+ + Hexify::hexify(MD5::getHash(A2)))));
- std::string responseValue = Hexify::hexify(MD5::getHash(
- Hexify::hexify(MD5::getHash(A1)) + ":"
- + *challenge.getValue("nonce") + ":" + nc + ":" + cnonce + ":" + qop + ":"
- + Hexify::hexify(MD5::getHash(A2))));
DIGESTMD5Properties response;
response.setValue("username", getAuthenticationID());