From cae88fe0f7418e5cd630b28e2ea93f4577d1d0dc Mon Sep 17 00:00:00 2001 From: Dylan McClung Date: Tue, 20 Oct 2009 21:33:38 -0500 Subject: [PATCH 2/2] Update for JRUBY-4012 --- src/java/org/jruby/ext/openssl/Cipher.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/java/org/jruby/ext/openssl/Cipher.java b/src/java/org/jruby/ext/openssl/Cipher.java index 85cf44b..8c50db2 100644 --- a/src/java/org/jruby/ext/openssl/Cipher.java +++ b/src/java/org/jruby/ext/openssl/Cipher.java @@ -365,7 +365,13 @@ public class Cipher extends RubyObject { if(ivBytes.length < ivLen) { throw new RaiseException(getRuntime(), ciphErr, "iv length to short", true); } - this.realIV = ivBytes; + else if(ivBytes.length > ivLen) { + byte[] iv2 = new byte[ivLen]; + System.arraycopy(ivBytes, 0, iv2, 0, ivLen); + this.realIV = iv2; + } else { + this.realIV = ivBytes; + } this.orgIV = this.realIV; ciphInited = false; return iv; -- 1.6.4.2