AES 256 from Java : I'm trying to reproduce an encryption/decryption done in `Java` to a `Ruby` one. 

`Java` code comes from [here][1]

I have a problem with the decryption. Here is my ruby code:

    key = Digest::SHA256.digest(key)
    aes = OpenSSL::Cipher.new('AES-256-CBC')
    aes.decrypt
    aes.key = Digest::SHA256.digest(key)
    aes.update(secretdata) + aes.final

    # => OpenSSL::Cipher::CipherError: bad decrypt




  [1]: https://stackoverflow.com/a/992119/2616474