Hi All,
I am able to parse the facebook challenge but I am unable to create
the challenge response. I have a class which create the response for
the challenge which has the following function:
public String getResponse(String algorithm, String clientNonceCount,
String clientNonce, String nonce, String digestUri) {
Log.i("server", ""+serverNonce);
if (realm == null) {
throw new RuntimeException("Could not create challange
without
realm.");
}
if (username == null) {
throw new RuntimeException("Could not create challange
without
username.");
}
if (password == null) {
throw new RuntimeException("Could not create challange
without
password.");
}
if (nonce == null) {
throw new RuntimeException("Could not create challange
without
serverNonce.");
}
byte[] ha1 = Digest.MD5(username, ":", realm, ":", password);
if (algorithm != null && algorithm.equals("md5-sess")) {
ha1 = Digest.MD5(ha1, ":".getBytes(),
Base64.encodeBase64(nonce.getBytes()), ":".getBytes(),
clientNonce.getBytes(), ":".getBytes(), username.getBytes());
}
byte[] ha2 = Digest.MD5("AUTHENTICATE", ":", digestUri);
if (clientNonceCount == null || clientNonce == null) {
return Digest.toHex(Digest.MD5(
Digest.toHex(ha1),
":",
new
String(Base64.encodeBase64(nonce.getBytes())),
":",
Digest.toHex(ha2)));
} else {
return Digest.toHex(Digest.MD5(
Digest.toHex(ha1),
":",
new
String(Base64.encodeBase64(nonce.getBytes())),
":",
clientNonceCount,
":",
clientNonce,
":",
"auth",
":",
Digest.toHex(ha2)));
}
}
and I call it as:
String resp = sasl.getClientResponse("md5-sess", "00000001", cnonce,
nonce, "xmpp/chat.facebook.com");
Do Any body have idea what is wrong with this code. becuase it is not
generate correct response.
I'll thankful you for you help in anticipation.
Regards,
Ali
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en