简体   繁体   中英

Best way to store bank account information of users?

What is the best way to safely store bank account information of users in a ruby on rails app?

I would like to store the information in a way in which admins can view the full bank info while still being encrypted in the database.

The point of this is so that I have a quick reference to their bank info in order to wire money to their bank accounts from my own bank website.

Is this a good idea?

Any ideas for doing this securely with minimum liability?

Thanks

for something like this I like to use the attr_encrypted gem this is really simple to use

1) add the attr_encrypted to the Gemfile

gem "attr_encrypted" 

2) now in your model you can do something like

class User
  attr_encrypted :bank_account_number, key: 'This is a key that is 256 bits!!'
end

3) now all you need to know is how to get the data out

  user = User.new
  user.bank_account_number = '123456789'
  user.bank_account_number # returns the unencrypted object ie. '123456789'
  user.encrypted_bank_account_number # returns the encrypted version of :bank_account_number

I hope that this helps Happy Hacking user.save

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM