AES Decryption doesn't work with Java Liveconnect

RESOLVED WORKSFORME

Status

Core Graveyard
Java: Live Connect
RESOLVED WORKSFORME
10 years ago
8 years ago

People

(Reporter: ben, Unassigned)

Tracking

({regression})

1.9.0 Branch
regression

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5

In Firefox 3 b5 on Windows, AES decryption (specifically, doFinal of javax.crypto.Cipher) doesn't return the correct result.  It isn't my Java environment because the code runs properly on Firefox 2.

Reproducible: Always

Steps to Reproduce:
1.Navigate to testliveconnect.html (see attached)
Actual Results:  
[0,1,2,3]
[1,1,1,1]
Does encryption work? false

Expected Results:  
[0,1,2,3]
[0,1,2,3]
Does encryption work? true

Java: (build 1.6.0_05-b13)
(Reporter)

Comment 1

10 years ago
Created attachment 321332 [details]
HTML page with embedded javascript that tests for the bug
(Reporter)

Comment 2

10 years ago
Created attachment 321657 [details]
Test for the issue

Fixed a small problem where the failed text was already there before the test is run.
Attachment #321332 - Attachment is obsolete: true
Component: General → Java: Live Connect
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → live-connect
Hardware: PC → All
(Reporter)

Comment 3

10 years ago
It's been a while since this bug has been touched.  Has any one else been able to confirm this bug?

Comment 4

10 years ago
Confirmed with Java 1.5.0 on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008052912 Firefox/3.0. The attached testcase works on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/2008040414 Firefox/2.0.0.14.

Comment 5

10 years ago
(In reply to comment #4)
> Confirmed with Java 1.5.0 on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9)
> Gecko/2008052912 Firefox/3.0. The attached testcase works on Mozilla/5.0 (X11;
> U; Linux i686; en-US; rv:1.8.1.14) Gecko/2008040414 Firefox/2.0.0.14.
> 

So, the bug is confirmed on windows in Fx3, and doesn't occur on Linux in Fx2?  Correct?  Do you plan in testing on Linux in Fx3?

Comment 6

10 years ago
On Mac, I get this (the "result" that is not the "expected results"):

[0,1,2,3]
[1,1,1,1]
Does encryption work? false

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9) Gecko/2008061004 Firefox/3.0

So, I'm hoping that it occurs in Linux too so I can mark it for all platforms instead of just Windows.  Of course, I'm using an Intel mac, so no idea what happens on PPC.

Comment 7

10 years ago
[00:33:29] <@gavin> Tom: logan confirmed the bug exists on linux fx3
[00:33:37] <@gavin> and confirmed that it doesn't exist on linux fx2

Confirming
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

10 years ago
Version: unspecified → 1.9.0 Branch
Any chance you could find a regression range using builds from ftp://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/ , per http://wiki.mozilla.org/MozillaQualityAssurance:Home_Page#What_We_Use ?
Keywords: regression
(Reporter)

Comment 9

10 years ago
Created attachment 326102 [details]
Workaround for the issue

Use Java reflection to create and populate a byte array instead of relying on Java Liveconnect.  Fix tested on Mac OS X and Windows.
(Reporter)

Comment 10

10 years ago
Created attachment 326104 [details]
Another test with strange results

This was an attempt to show that Java Liveconnect's array conversion returns an array with all 1's when converting JS arrays to Java byte arrays.  I did show that, but I also found another regression: FF3's LiveConnect can't construct strings from byte arrays.

In Firefox 2 (expected results):
[64,65,66,67]
[64,65,66,67]

In Firefox 3:
TypeError: invalid new expression result \x01\x01\x01\x01
TypeError: invalid new expression result @ABC
(Reporter)

Comment 11

10 years ago
Something I didn't mention above: this bug is indicative of a bigger problem.  Java Liveconnect no longer properly converts Javascript arrays into Java arrays (at least for bytes).  Java Liveconnect always returns arrays full of 1's.

There is another bug describing this problem: https://bugzilla.mozilla.org/show_bug.cgi?id=434658.

Comment 12

10 years ago
(In reply to comment #11)
> Something I didn't mention above: this bug is indicative of a bigger problem. 
> Java Liveconnect no longer properly converts Javascript arrays into Java arrays
> (at least for bytes).  Java Liveconnect always returns arrays full of 1's.
> 
> There is another bug describing this problem:
> https://bugzilla.mozilla.org/show_bug.cgi?id=434658.
> 

Yes, but bug 434658 was posted 3 days after this one.  What gavin is asking in comment 8 is if you know when it started.  An easy way to do this is try actual beta versions, they're archived on the FTP.  You can find beta 1 here:
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.0b1/
and later versions by going to the main releases directory and trying other betas or release candidates.
(Reporter)

Comment 13

9 years ago
Since bug 434658 has been resolved as works-for-me and the attached test is now in fact working for me, resolving as WORKSFORME.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → WORKSFORME

Updated

8 years ago
Component: Java: Live Connect → Java: Live Connect
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.