The constructor parameter actually reads <name>-<key length>-<mode>
, so first of all, you probably want to use AES-256-CBC
in order to use a 256 Bit key. [source]
The AES Block size is fixed to 128 Bit anyway, so you do not need to adjust this parameter. [source]
Also, it seems that Ruby uses PKCS7 Padding by default, so there's no need to adjust this, either. [source]
Therefore, you should be good to go with just
c = OpenSSL::Cipher.new('AES-256-CBC')
c.decrypt
c.key = key
c.iv = iv