diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-14 18:57:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-14 21:36:32 (GMT) |
commit | cb05f5a908e20006c954ce38755c2e422ecc2388 (patch) | |
tree | a793551a5fe279a57d4330119560e8542f745484 /Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp')
-rw-r--r-- | Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp index 050b73b..6892948 100644 --- a/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp +++ b/Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp @@ -13,7 +13,7 @@ namespace Swift { -DIGESTMD5ClientAuthenticator::DIGESTMD5ClientAuthenticator(const String& host, const String& nonce) : ClientAuthenticator("DIGEST-MD5"), step(Initial), host(host), cnonce(nonce) { +DIGESTMD5ClientAuthenticator::DIGESTMD5ClientAuthenticator(const std::string& host, const std::string& nonce) : ClientAuthenticator("DIGEST-MD5"), step(Initial), host(host), cnonce(nonce) { } boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const { @@ -21,29 +21,29 @@ boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const { return boost::optional<ByteArray>(); } else if (step == Response) { - String realm; + std::string realm; if (challenge.getValue("realm")) { realm = *challenge.getValue("realm"); } - String qop = "auth"; - String digestURI = "xmpp/" + host; - String nc = "00000001"; + std::string qop = "auth"; + std::string digestURI = "xmpp/" + host; + std::string nc = "00000001"; // Compute the response value ByteArray A1 = MD5::getHash(getAuthenticationID() + ":" + realm + ":" + getPassword()) + ":" + *challenge.getValue("nonce") + ":" + cnonce; - if (!getAuthorizationID().isEmpty()) { + if (!getAuthorizationID().empty()) { A1 += ":" + getAuthenticationID(); } - String A2 = "AUTHENTICATE:" + digestURI; + std::string A2 = "AUTHENTICATE:" + digestURI; - String responseValue = Hexify::hexify(MD5::getHash( + 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()); - if (!realm.isEmpty()) { + if (!realm.empty()) { response.setValue("realm", realm); } response.setValue("nonce", *challenge.getValue("nonce")); @@ -53,7 +53,7 @@ boost::optional<ByteArray> DIGESTMD5ClientAuthenticator::getResponse() const { response.setValue("digest-uri", digestURI); response.setValue("charset", "utf-8"); response.setValue("response", responseValue); - if (!getAuthorizationID().isEmpty()) { + if (!getAuthorizationID().empty()) { response.setValue("authzid", getAuthorizationID()); } return response.serialize(); |