5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

attr_encryptedを手動で復号する方法

Last updated at Posted at 2015-07-29

諸事情から、rubyスクリプトで、attr_encryptedで暗号化されたデータを復号する必要があったのでメモ

memo
$ sudo gem install attr_encrypted
$ irb
irb> require 'attr_encrypted'
irb> require 'base64'
irb> class User
irb>  attr_encrypted :hoge, :key => 'secret_key'
irb> end
irb> user = User.new
irb> p user.decrypt(:hoge,Base64.decode64('dbに保管されているデータ') )
"元データ"
=> "元データ"
5
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?