我有一个Rails 4.2.1项目,需要一个与openssl 2.1.1有关的gem。我的红宝石版本是2.3.1。当我添加openssl gem时,对于我加载的任何页面,都会出现以下错误:
lib/active_support/message_encryptor.rb:100: warning: constant OpenSSL::Cipher::Cipher is deprecated
ArgumentError (key must be 32 bytes):
activesupport (4.2.1) lib/active_support/message_encryptor.rb:72:in `key='
activesupport (4.2.1) lib/active_support/message_encryptor.rb:72:in `_encrypt'
activesupport (4.2.1) lib/active_support/message_encryptor.rb:58:in `encrypt_and_sign'
actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:527:in `[]='
actionpack (4.2.1) lib/action_dispatch/middleware/session/cookie_store.rb:110:in `set_cookie'
rack (1.6.10) lib/rack/session/abstract/id.rb:351:in `commit_session'
rack (1.6.10) lib/rack/session/abstract/id.rb:226:in `context'
rack (1.6.10) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
是否存在使两者兼容的解决方法?
答案 0 :(得分:0)
在不更改旧密钥的情况下,我使用下面的代码来接收密钥:succsscull:
attr_encrypted:属性,密钥:ENV ['MY_KEY']。bytes [0..31] .pack(“ c” * 32)