Title: [896] trunk/jopenssl: Fix for JRUBY-1100, truncate IV if it's too long.
Revision
896
Author
olabini
Date
2008-02-11 08:23:36 -0500 (Mon, 11 Feb 2008)

Log Message

Fix for JRUBY-1100, truncate IV if it's too long. Also update JOpenSSL to new JRuby trunk, and to build with 1.5

Modified Paths

Diff

Modified: trunk/jopenssl/Rakefile (895 => 896)


--- trunk/jopenssl/Rakefile	2008-02-11 12:06:12 UTC (rev 895)
+++ trunk/jopenssl/Rakefile	2008-02-11 13:23:36 UTC (rev 896)
@@ -23,7 +23,7 @@
 desc "Compile the native Java code."
 task :java_compile do
   mkdir_p "pkg/classes"
-  sh "javac -target 1.4 -source 1.4 -d pkg/classes #{java_classpath_arg} #{FileList['src/java/**/*.java'].join(' ')}"
+  sh "javac -target 1.5 -source 1.5 -d pkg/classes #{java_classpath_arg} #{FileList['src/java/**/*.java'].join(' ')}"
   File.open("pkg/classes/manifest.mf", "w") {|f| f.puts "Class-Path: #{BC_JARS.map{|f| File.basename(f) }.join(' ')}"}
   sh "jar cfm lib/jopenssl.jar pkg/classes/manifest.mf -C pkg/classes/ ."
 end

Modified: trunk/jopenssl/build.xml (895 => 896)


--- trunk/jopenssl/build.xml	2008-02-11 12:06:12 UTC (rev 895)
+++ trunk/jopenssl/build.xml	2008-02-11 13:23:36 UTC (rev 896)
@@ -9,8 +9,8 @@
   <property name="target.classes.test" value="${target}/test-classes"/>
   <property name="lib.dir" value="lib"/>
   <property name="jruby.jar" value="${jruby.home}/lib/jruby.jar"/>
-  <property name="version.source" value="1.4"/>
-  <property name="version.target" value="1.4"/>
+  <property name="version.source" value="1.5"/>
+  <property name="version.target" value="1.5"/>
 
   <path id="build.classpath">
     <fileset dir="${lib.dir}" includes="*.jar" excludes="jopenssl.jar,jruby.jar"/>

Modified: trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java (895 => 896)


--- trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java	2008-02-11 12:06:12 UTC (rev 895)
+++ trunk/jopenssl/src/java/org/jruby/ext/openssl/Cipher.java	2008-02-11 13:23:36 UTC (rev 896)
@@ -43,6 +43,7 @@
 import org.jruby.RubyNumeric;
 import org.jruby.RubyObject;
 import org.jruby.RubyString;
+import org.jruby.common.IRubyWarnings;
 import org.jruby.exceptions.RaiseException;
 import org.jruby.runtime.Block;
 import org.jruby.runtime.CallbackFactory;
@@ -334,6 +335,13 @@
         if(keyBytes.length < keyLen) {
             throw new RaiseException(getRuntime(), ciphErr, "key length to short", true);
         }
+
+        if(keyBytes.length > keyLen) {
+            byte[] keys = new byte[keyLen];
+            System.arraycopy(keyBytes, 0, keys, 0, keyLen);
+            keyBytes = keys;
+        }
+
         this.key = keyBytes;
         return key;
     }
@@ -499,7 +507,7 @@
     }
 
     public IRubyObject update_deprecated(IRubyObject data) {
-        getRuntime().getWarnings().warn("" + this.getMetaClass().getRealClass().getName() + "#<< is deprecated; use " + this.getMetaClass().getRealClass().getName() + "#update instead");
+        getRuntime().getWarnings().warn(IRubyWarnings.ID.DEPRECATED_METHOD, "" + this.getMetaClass().getRealClass().getName() + "#<< is deprecated; use " + this.getMetaClass().getRealClass().getName() + "#update instead");
         return update(data);
     }
 
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to