0
繼承的ruby代碼庫,它使用attr_encrypted gem來加密屬性。Rails OpenSSL加密/解密?
我想解密值並加密它們。簡單的任務!
解密工作。
再次加密返回不起作用?
這裏的代碼解密:
Encryptor.decrypt(Base64.decode64("mbgtmCefo8NZOWrSmrq0frYpMR8nRFRz83CkX7VqxAs="), :key=>'95f94bbd12fb60c156aea0c5fead8498b10cff780624b064a98d9aefa74e6a43b2cf7bfb4d0ab5fa44541b5e5385ccf0ef0e1bb563a6ea618f14c2770b583ba')
=> "4763671098237511"
這裏的代碼進行加密:
Encryptor.encrypt(Base64.encode64("4763671098237511"), :key=>'95f94bbd12fb60c156aea0c5fead8498b10cff780624b064a98d9aefa74e6a43b2cf7bfb4d0ab5fa44541b5e5385ccf0ef0e1bb563a6ea618f14c2770b583ba')
=> "\xC7\xB4\xEB\xE8d\x11l\xB2\xC3\xCDd8\x1E\x88\xDD\xF3\x93\x96H6*\xD2!\f\x9C%F\x14\xE7\xC7\xF3\x1F"
代碼我期待:
"mbgtmCefo8NZOWrSmrq0frYpMR8nRFRz83CkX7VqxAs="
有人能澄清這個問題?
非常感謝!