You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cipher.final should not be required for streaming ciphers #5772
jruby 9.2.6.0 (2.5.3) 2019-02-11 15ba00b OpenJDK 64-Bit Server VM 11.0.2+9 on 11.0.2+9 +jit [darwin-x86_64]
Darwin Kelleys-MBP.neo.rr.com 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
Expected Behavior
OpenSSL::Cipher.new('aes-256-ctr') should not require cipher.final for streaming ciphers
Actual Behavior
It requires cipher.final to get the trailing bytes
Sample script
require'openssl'require'securerandom'# String which will have 4 trailing bytesstring='a'.b*20cipher=OpenSSL::Cipher.new('aes-256-ctr')cipher.iv=SecureRandom.random_bytes(16)cipher.key=SecureRandom.random_bytes(32)# str should be 20 bytes longputscipher.update(string).size# In MRI# => 20# In JRuby# => 16
Activity
shibz commentedon Jun 27, 2019
cipher.update and cipher.final have different behavior in JRuby vs MRI for block ciphers also when data is added in KEY_LENGTH sized chunks.
headius commentedon Jul 9, 2019
This might get more responses if filed with https://github.com/jruby/jruby-openssl but copying @kares here so everyone relevant sees it.
kreynolds commentedon Jul 10, 2019
Ah .. I didn't realize that was a separate thing. I refiled there and will close this issue.