Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing oaep encryption to use correct algorithm #54

Merged
merged 3 commits into from
Jul 13, 2015

Conversation

balmas
Copy link
Contributor

@balmas balmas commented Jul 8, 2015

Proposed fix for problem reported in jruby/jruby#1819

I have to confess that writing a reasonable java test for this change is beyond me, but at line 99 the constant PKCS1_OAEP_PADDING is set to 4. The test on the changed line was previously selecting the algorithm /ECB/OAEPWithMD5AndMGF1Padding for oaep, but this does not work against data that declares itself as encoded according to http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p and my reading of section 5.4.2 of the xmlenc spec says that this must always be used with SHA1 (and not MD5).

If desired, I can provide sample data and ruby code that demonstrates the problem and verifies the fix.

@kares
Copy link
Member

kares commented Jul 9, 2015

looking good, probably an old compatibility issue ... possibly we would need to make sure it does not regress on 1.8.7 since JRuby 1.7.x still supports --1.8 mode.

UPDATE: sample data and .rb code demonstrating the problem might turn out useful.

@balmas
Copy link
Contributor Author

balmas commented Jul 9, 2015

Hi I added the test to confirm creation of a Cipher object with RSA/ECB/OAEPWithSHA1AndMGF1Padding and it doesn't fail on regressions with 1.8 mode (e.g. mvn test -Djruby.versions=1.7.12 -Djruby.modes=1.8 -Dbc.versions=1.47) although I'm not sure that's really a meaningful test.

Will add sample data and ruby code demonstrating the problem shortly.

@balmas
Copy link
Contributor Author

balmas commented Jul 9, 2015

Okay, ruby code and test data added (in src/test/ruby/oaep).

Confirmed passes with new code, and raises error with old. No errors reported running test in 1.8 mode.

Let me know if I can do anything else. Thanks!

kares added a commit that referenced this pull request Jul 13, 2015
fixing oaep encryption to use correct algorithm
@kares kares merged commit 01d6948 into jruby:master Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants