This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: security providers and ...
- From: Lars Andersen <lars at rimfaxe dot com>
- To: java at gcc dot gnu dot org
- Cc: raif at fl dot net dot au, vpuskas at eunet dot yu
- Date: 16 Aug 2002 14:32:06 +0200
- Subject: Re: security providers and ...
> Vladimir Puskas wrote:
>
>On Monday 15 July 2002 00:19, Mark Wielaard wrote:
>
>
>But I don't think they are very well tested so please let us know
>if they work correctly for you.
>
>gnu.java.security.provider.MD5 should extend
>java.security.DigestMessage instead of DigestMessageSpi, because now it
>throws exception:
>java.lang.ClassCastException:
>gnu.java.security.provider.MD5 cannot be cast to
>java.security.MessageDigest
>when trying to MessageDigest.getInstance("MD5")...
>
>Bellow are the changes I made to get it work...
>pls be aware that if you incorporate this change, implementations of
>message digests not already in the java.security package (e.g. in
>gnu.crypto) will fail in the same way.
>
>i think the cure is:
>
>1. to catch the ClassCastException,
>2. test if the newly instantiated class is an instance of
>java.security.MessageDigestSpi,
>3. if it isnt re-throw the exception, otherwise
>4. wrap the newly instantiated class in a proxy class that channels the
>MessageDigest calls to the wrapped Spi (inner) class.
>
>
>cheers;
>rsn
OK, I have noticed the same behaviour, a ClassCastException when
requesting the MD5 MessageDigest from the "GNU" security provider, but
please consider :
1: the gnu security provider works fine in sun jdk1.4.
I tried to use Reflection to see how it was handled, and it returned the
type : MessageDigest$Delegate, not just MessageDigest.
2: It only fails in GCJ in static compiled binaries. I have used the GNU
MD5 MessageDigest with GCJ compiled binaries, only when i added the
-static option did i get this error.
I think the problem is buried somewhere else. The MessageDigestSpi class
is intended (long time ago...) for security providers to implement
MessageDigest implementations.
regards
Lars Andersen