tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Digest
Date Thu, 07 Aug 2003 06:06:03 GMT
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.

"Nikola Milutinovic" <Nikola.Milutinovic@ev.co.yu> wrote in message
news:003d01c35ca2$f5ad0480$6e3da8c0@ev.co.yu...
> > In a jsp application i want to calculate digested passowrds dynamically
> > According to the Realm How To ... i write this code in a jsp :
> >
> > <% String digest =
> >
org.apache.catalina.realm.RealmBase.Digest(request.getParameter("password"),
> > "MD5"); %>
>
> Isn't there a "Digest" method in some, more public place? JAAS or some
cryptography?
>
> > Here is the result :
> >
> > org.apache.jasper.JasperException: Unable to compile class for JSP
> > Generated servlet error:
> > [...] package org.apache.catalina.realm does not exist [...]
>
> In other words, "javac" has no knowledge of Tomcat's internal classes, as
it shouldn't.
>
> > [javac] String digest =
> >
org.apache.catalina.realm.RealmBase.Digest(request.getParameter("password"),
> > "MD5");
> > [javac]
> >
> > How can i fix that ? catalina.jar is not in tomcat classpath ?
>
> I'd sugest looking for "Digest" in some of the public APIs of Java
platform. That way you will be transparent to the container (IOW, you'll be
able to run your web-app on something other than Tomcat).
>
> Nix.
>




Mime
View raw message