Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby-OSSL 0.7.7
-
Component/s: OpenSSL
-
Labels:None
-
Environment:Amazon EC2 small instance running Ubuntu 8.04
-
Testcase included:yes
-
Number of attachments :
Description
I'm seeing inconsistencies and errors in encrypting/decrypting with jruby-openssl on my EC2 instance. However, everything works fine on my Mac.
OSX 10.6.2 – All is well here
$ java -version java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025) Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode) $ ruby -v ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] $ ruby ./openssl-test.rb dF5wf1txacDI8THpPchSow== hello world $ jruby -v jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [x86_64-java] $ jgem list | grep openssl jruby-openssl (0.5.2) $ jruby ./openssl-test.rb dF5wf1txacDI8THpPchSow== hello world .. snip jruby-openssl upgrade .. $ jgem list | grep openssl jruby-openssl (0.6) $ jruby ./openssl-test.rb dF5wf1txacDI8THpPchSow== hello world
Ubuntu 8.04 on EC2 - MRI works fine, but both 0.5.2 and 0.6.0 versions of jRuby-OpenSSL product bad results
$ java -version java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing) $ ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux] $ ruby ./openssl-test.rb dF5wf1txacDI8THpPchSow== hello world $ ./jruby -v jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) Client VM 1.6.0_17) [i386-java] $ ./jruby -S gem list | grep openssl jruby-openssl (0.5.2) $ ./jruby ./openssl-test.rb bTpKPcb5aXzjVnSpRoIc/Q== hello world .. snip jruby-openssl upgrade .. $ ./jruby -S gem list | grep openssl jruby-openssl (0.6) $ ./jruby ./openssl-test.rb ./openssl-test.rb:11: Illegal key size (OpenSSL::Cipher::CipherError)
Please note that in addition to the 0.6.0 error, the encrypted string for 0.5.2 is incorrect
You need to override JCE Unlimited Strength Jurisdiction Policy Files (local_policy.jar and US_export_policy.jar) in $JAVA_HOME/jre/lib/security/ to use AES256. I don't know Amazon EC2 allows it or not...
Can you change cipher spec to AES128 for a workaroud?