[android-developers] Re: Unhandled algorithm md5 requested

2011-04-16 Thread marten
I've reported this bug: http://code.google.com/p/android/issues/detail?id=16051

also, I've found an easy way to work around this issue.

You have to subclass DigestScheme to let getParameter return MD5 if
the algorithm was md5:

public class FixedDigestScheme extends DigestScheme
{

@Override
public String getParameter(final String name)
{
String param = super.getParameter(name);
if (algorithm.equals(name)  MD5.equalsIgnoreCase(param))
{
return MD5;
}
return param;
}

}

Also you have to subclass AuthSchemeFactory to return your new
FixedDigestScheme:

public class FixedDigestSchemeFactory implements AuthSchemeFactory
{
public AuthScheme newInstance(final HttpParams params)
{
return new FixedDigestScheme();
}
}

the tell your HttpClient instance to use the new DigestScheme:

AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry();
authSchemeRegistry.register(Basic, new BasicSchemeFactory());
authSchemeRegistry.register(Digest, new FixedDigestSchemeFactory());
mHttpClient.setAuthSchemes(authSchemeRegistry);

that's all. It works for me. Maybe someone can use it ...

On 14 Mrz., 20:30, marten marten.ga...@googlemail.com wrote:
 I had a look into the Eclair sources. It seems the available
 algorithms are hard-coded in MessageDigest.java. So there is no way to
 add another one without modifying the sources.
 Can anyone tell me if it's correct to assume that the digest algorithm
 is case-sensitive? Or is this a bug?

 On 14 Mrz., 08:39, marten marten.ga...@googlemail.com wrote:

  Hello,

  I'm writing a CardDAV implementation for Android and came across some
  problem when trying to connect to the OSX/Darwin CardDAV server.
  The default setup for this server is to advertise BASIC and DIGEST
  authentication. The default algorithm for DIGEST authentication is set
  to md5.
  Without changing the defaults I can not login to the server. I always
  get the following error in the logs:

  E/estTargetAuthentication( 2749): Authentication error: Unhandled
  algorithm md5 requested

  If I change md5 to MD5 in the server's configuration I can login
  to the server.
  In my opinion Android is right and it should be MD5 instead of
  md5. Nevertheless, is there any way to make Android's HTTP
  implementation more tolerant? Can I register md5 as an
  implementation of MD5 somehow?
  I don't want to ask all OS X users to change the defaults ...
  especially since OS X users are used to that it just works ;-) .

  cheers

  Marten

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Unhandled algorithm md5 requested

2011-03-14 Thread marten
I had a look into the Eclair sources. It seems the available
algorithms are hard-coded in MessageDigest.java. So there is no way to
add another one without modifying the sources.
Can anyone tell me if it's correct to assume that the digest algorithm
is case-sensitive? Or is this a bug?

On 14 Mrz., 08:39, marten marten.ga...@googlemail.com wrote:
 Hello,

 I'm writing a CardDAV implementation for Android and came across some
 problem when trying to connect to the OSX/Darwin CardDAV server.
 The default setup for this server is to advertise BASIC and DIGEST
 authentication. The default algorithm for DIGEST authentication is set
 to md5.
 Without changing the defaults I can not login to the server. I always
 get the following error in the logs:

 E/estTargetAuthentication( 2749): Authentication error: Unhandled
 algorithm md5 requested

 If I change md5 to MD5 in the server's configuration I can login
 to the server.
 In my opinion Android is right and it should be MD5 instead of
 md5. Nevertheless, is there any way to make Android's HTTP
 implementation more tolerant? Can I register md5 as an
 implementation of MD5 somehow?
 I don't want to ask all OS X users to change the defaults ...
 especially since OS X users are used to that it just works ;-) .

 cheers

 Marten

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en