Lockbox: simple attribute encryption for your Rails models

Posted by James Harton Sun, 23 Aug 2009 05:23:00 GMT

After a short discussion I had at work about storing secrets on a web application I threw together this Rails plugin which handles public key cryptography using RSA key pairs. In my particular use case I wanted to stop the web application from running at all if the passphrase hasn't been provided.

Lockbox is very simple to use, you can test if the Lockbox is locked using Lockbox.locked? or Lockbox.unlocked?, try unlocking the private key using Lockbox.try? 'my passphrase', lock it again using Lockbox.lock! and of course encryption is done using Lockbox.encrypt(str) and Lockbox.decrypt(str).

I plan to add acts_as_lockbox functionality for ActiveRecord models in the future.

Lockbox is available at Github, you can install it with the following:

./script/plugin install git://github.com/jamesotron/Lockbox.git

The README file contains documentation on configuring your keys, etc.

Tags , , , , , , , , ,  | no comments

Comments

(leave url/email »)