classpathx-crypto
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpathx-crypto] GCJ JUnit result.


From: Raif S. Naffah
Subject: Re: [Classpathx-crypto] GCJ JUnit result.
Date: Thu, 04 Jul 2002 02:31:55 +1000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530


Olivier LF wrote:
...I did try the naive approach of replacing:

   MessageDigest md = MessageDigest.getInstance("SHA", GNU);
   ...
   ...
   MessageDigest md = MessageDigest.getInstance("WHirlpool", GNU);

with:

   MessageDigest md = MessageDigest.getInstance("SHA-160", GNU);
   ...
   ...
   MessageDigest md = MessageDigest.getInstance("WHIRLPOOL", GNU);

In TestOfProvider.java, I now get:

java.lang.ClassCastException: gnu.crypto.jce.Sha160Spi cannot be cast to
java.security.MessageDigest

this is a 2nd bug in the MessageDigest implementation (method getInstance with 3 args) caused by the line:


MessageDigest m =
      (MessageDigest) Class.forName(classname).newInstance();

the fix is:

1. to catch the ClassCastException,
2. test if the newly instantiated class is an instance of java.security.MessageDigestSpi,
3. if it isnt throw the exception, otherwise
4. wrap the newly instantiated class in a proxy class that channels the MessageDigest calls to the wrapped Spi class.


how about that! we started testing our code, and ended up testing the gcj/classpath.

do you have enough info to file bug reports?


cheers;
rsn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]