tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxime Colas des Francs <max...@sts.ca>
Subject Re: Digest
Date Thu, 07 Aug 2003 12:51:12 GMT

Thks for your response !

But I have now another pb .

javadoc for org.apache.catalina.realm.RealmBase.Digest() says :
  ... Digest password using the algorithm especificied and convert the 
result to a corresponding hex string ...

So how to convert my base64(MD5()) digest to the correct hex String ?
I try Integer.toHexString on each byte ... no good.

MD5 digest for realm auth don't seem to be a simple MD5 digest ..

At 06:42 2003-08-07 -0400, you wrote:
>My favorite Base64 library is org.apache.catalina.util.Base64 ;)
>
>-Tim
>
>Bill Barker wrote:
>>I agree with Nikola. Firstly, even if you could access Catalina internals,
>>you are calling the wrong method.  You would need to call getDigest(String
>>userName, String Pass).  From the RealmBase code, you probably want
>>something like:
>><%
>>   MessageDigest md = MessageDigest.getInstance("MD5");
>>   String preDigest = request.getParameter("user")+
>>":"+RealmName+request.getParameter("password");
>>   byte [] pwd = md.digest(preDigest.getBytes());
>>   String digest = toBase64(pwd);
>>%>
>>Here, toBase64 is your favorite byte->base64 encoding library.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message