harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Liang" <richard.lian...@gmail.com>
Subject Re: [classlib][security] problem processing SHA signatures in JBoss installer manifest
Date Wed, 13 Sep 2006 02:42:32 GMT
After two-day struggling with JarFile, ObjectInputStream and
MessageDigest, in the end, I have identified the root cause. And now I
have two panda-eyes[1] ;-)

It seems a bug of
org.apache.harmony.security.provider.crypto.SHA1Impl.  As I have no
idea about SHA1. Could any one have a look at this problem?

The following test case passes on RI, but fails on Harmony.

    public void testUpdate() throws NoSuchAlgorithmException {
        byte[] bytes = { 0x6e, 0x61, 0x6d, 0x65};
        MessageDigest sha1 = MessageDigest.getInstance("SHA1");
        byte[] digest1 = sha1.digest();
        byte b = 0x04;
        sha1.update(b);

        for (int i = 0; i < bytes.length; i++) {
            sha1.update(bytes[i]);
        }
        byte[] digest2 = sha1.digest();

        sha1.reset();
        byte[] digest3 = sha1.digest();
        assertTrue(MessageDigest.isEqual(digest1, digest3));

        sha1.update(b);
        sha1.update(bytes, 0, bytes.length);
        byte[] digest4 = sha1.digest();

        assertTrue(MessageDigest.isEqual(digest2, digest4));
    }

[1]http://www.panda.org.cn/zhuye/bbe.jpg

Best regards,
Richard

On 9/11/06, Richard Liang <richard.liangyx@gmail.com> wrote:
> On 9/9/06, Geir Magnusson Jr. <geir@pobox.com> wrote:
> > I was trying the latest snapshot with the JBoss installer (4.0.1) and
> > found a problem processing the SHA signatures int the jar manifest.
> >
> > I've entered a JIRA - HARMONY-1412
> >
>
> I will have a look at it. ;-)
>
> > geir
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
>
> --
> Richard Liang
> China Software Development Lab, IBM
>


-- 
Richard Liang
China Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message