You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alessandro Colantoni <al...@gmail.com> on 2006/03/22 19:11:39 UTC

return (HexUtils.convert(md.digest())) in RealmBase

Hi All!
I saw that both method Digest(..) and digest(..) in RealmBase return (
HexUtils.convert(md.digest())) and not just
md.digest().toString.

My problem is that user table is maintained by another application developed
in an other technology.
My application uses this table just to authenticate.
The password of user table is encrypted with an algorithm I've been done.
I wrote a MessageDigestSpi for that algorithm, I wrote my provider, I
registered it and everything looks work fine.
Except that of course if I do:
 RealmBase.Digest(myCredentials,myAlgorithm);

I get a result different from doing
MessageDigest md = MessageDigest.getInstance(myAlgorithm);
md.update(myCredentials.getBytes());
md.digest().toString;

but the same result of
 MessageDigest md = MessageDigest.getInstance(myAlgorithm);
 md.update(myCredentials.getBytes());
HexUtils.convert(md.digest())

So the problem is that the other application stores without using the
HexUtils.convert method
but when tomcat authenticates it uses it.

One solution could be write a Realm class that extends the JDBCRealm (the
one I'm using) and overwrite these methods.
But I'm afraid that in different versions of Tomcat (i don't want link to
one) could be different signature of these methods.
There's another solution?
At least avoiding overwriting these very important methods?

And just for curiosity, why HexUtils.convert has been utilized?

Thanks in advance for help and have a nice springtime
Alessandro