Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 91675 invoked from network); 7 Aug 2003 05:55:37 -0000 Received: from main.gmane.org (80.91.224.249) by daedalus.apache.org with SMTP; 7 Aug 2003 05:55:37 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19kdkB-000636-00 for ; Thu, 07 Aug 2003 07:55:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: tomcat-user@jakarta.apache.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19kdkA-00062v-00 for ; Thu, 07 Aug 2003 07:55:22 +0200 From: "Bill Barker" Subject: Re: Digest Date: Wed, 6 Aug 2003 23:06:03 -0700 Lines: 53 Message-ID: References: <5.2.1.1.0.20030806161504.02bb6db0@pop.videotron.ca> <003d01c35ca2$f5ad0480$6e3da8c0@ev.co.yu> X-Complaints-To: usenet@main.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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" 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. >