jruby-openssl
jruby-openssl copied to clipboard
Cipher#iv_len returns incorrect IV length for AES cipher in ECB mode
Cipher#iv_len is not returning the proper value for an ECB mode AES cipher.
MRI:
2.5.1 :002 > OpenSSL::Cipher.new("AES-128-ECB").iv_len
=> 0
JRuby:
jruby-9.1.15.0 :002 > OpenSSL::Cipher.new("AES-128-ECB").iv_len
=> 16
Since ECB mode does not rely on an IV, else if ( "ECB".equals(mode) ) should be above if ( "AES".equals(base) ) here so it returns 0
https://github.com/jruby/jruby-openssl/blob/master/src/main/java/org/jruby/ext/openssl/Cipher.java#L630