Encrypting Data in your Ruby on Rails Application

Whilst searching for a gem/plug-in to help with storing encrypted notes in a Rails app, I found strongbox. It uses public key encryption to encrypt and store data on a 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.

491113684_ee82e217f1_m.jpg
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 TODO list.

So let me know if you find it useful and don't forget to symlink the keys directory in your deployment scripts!


Bit Zesty - Ruby on Rails developers in London.
 

Posted by Matthew Ford 

1 comment

Sep 30, 2009
Wow, I hadn't thought about it that way before. Good write up, very clearly written. Have you written previously about Encryption Data? I'd love to read more.

Leave a comment...