Whilst searching for a gem/plug-in to help with storing encrypted notes in a Rails app, I came across strongbox. It uses public key encryption to encrypt and store data on an ActiveRecord attribute – Spike has a great writeup on his blog. One limitation I encountered was that it only uses one key to encrypt the data, which wasn’t going to work when I have multiple users, all storing private information.
So I wrote a wrapper around strongbox that I am releasing called Safe – a Rails engine for storing encrypted data. Safe handles the generating of the public and private keys and uses strongbox to encrypt and decrypt the data. It’s still in early stages, and it doesn’t support all of the options that strongbox does, but it is on the TO DO list.
So let me know if you find it useful and don’t forget to symlink the keys directory in your deployment scripts!