Fix break AES-128-CBC on Ruby 2.5.3. Change hard code 32 key len by cipher key len returned by OpenSSL.
Regarding to the issue https://github.com/chicks/aes/issues/17 Error in Ruby 2.5.3, set cipher.key: Exception “key must be 16 bytes" OpenSSL::Cipher.new('AES-128-CBC') only accept key with length is 16 bytes.
While in the code, it return 32-byte-key with totally 16 trailing zero bytes:
@key.unpack('a2'*32).map{|x| x.hex}.pack('c'*32) => "o\xA8\xBB\a#'\xF8\xD0\xE4\v\x85\xFA\xD9\x05\x10\xF9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
@chicks any thoughts on this PR? I am running into the same problem with the hard coded value. The fix seems like a general improvement and it would be great if we could merge it.
This project is deserted. :'( @dennissivia
@ntloi95 yeah, it seems so. And if nobody is at least merging fixes, I guess I have to switch to OpenSSL or another gem.
@vanaltj based on the last commit it seems that you also have permission to merge PRs? Can you take a look at this PR? That would be amazing.
@ntloi95 I guess you are right. Seems as if it will take some time until the PR will be merged if it will ever happen. In my project I decided to create this monkey patch based on your solution. So I am not blocked and can take my time to replace the implementation with OpenSSL.