rails encryption/decryption

后端 未结 3 1787
遇见更好的自我
遇见更好的自我 2021-02-06 06:01

i need to do encryption and decryption in my rails app. Im trying to use ezcrypto, but whenever i do decryption i get this error.

OpenSSL::Cipher::CipherError in         


        
3条回答
  •  渐次进展
    2021-02-06 06:29

    I had the same problem as you and this is how I solved it:

    1. Your database column has to be: t.column :data, :binary, :limit => 10.megabyte.
    2. Use the exact code as this blog post.
    3. Choose AES-256-ECB
    4. Leave ivs as nil
    5. Choose a long key

提交回复
热议问题