The documentation specifies the digest algorithms which can be used to avoid storing plain text passwords. Unfortunately passwords are strings and the input of digest algorithms are bytes, but the conversion between the two - the charset encoding to be used - is not specified. Looking at the source of org.apache.tomcat.modules.aaa.RealmBase it turns out that it uses the system default charset encoding, which is usually a bad idea for a server software. E.g. moving the server to another machine or using a second server with different locale renders the user database invalid. The best solution would be to explicitly specify an encoding, e.g. UTF-8. But at this moment this may break existing configurations. Another solution is to add an additional parameter to each realm implementation and the command line utility, in which the administrator can specify the encoding. The default of this parameter must be "encode using the platform's default charset", in order to not break compatiblity.
Assuming that you meant to file this against Tomcat 3 (which is where o.a.t.m.aaa.RealmBase lives :), this is fixed now in the CVS. The Realm now has a 'digestEncoding' attribute that can be used to specify the charset (defaulting to the default charset, for BC). Leaving the bug open, incase you really did mean Tomcat 5.
Yes, you are right, I mean Tomcat 5 and read the 5.5 doc but the Tomcat 3 source. However, now I also checked the 5.5 source, and the code - so the problem - is the same. The same fix could be equally useful for Tomcat 5 too.
Done for Tomcat 5.5(.4), doing for 5.0.(30) next.
Done -- thanks for submitting this issue.