Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rails plugin to transparently encrypt attributes

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 init.rb
Octocat-spinner-32 key.yml.example
README.rdoc

lucifer

Lucifer is Rails plugin which utilizes the ezcrypto gem to encrypt/decrypt database columns transparently.

Why is it called Lucifer? en.wikipedia.org/wiki/Lucifer_(cipher)

Installation

./script/plugin install git://github.com/jmckible/lucifer.git

Lucifer looks for a key and salt in config/key.yml. See key.yml.example

Usage

Add Lucifer to a class like so:

class Person < ActiveRecord::Base
  # Database columns - id(integer), ssn_b(binary)
  encrypt_attributes
end

Lucifer will treat any binary column that ends in _b as encryptable.

person = Person.new :ssn=>'000-00-0000'
=> Person...
person.save
=> true
Person.first.ssn
=> '000-00-0000'

If you check out the database, you'll see

> select * from people;
 ---------------------------------
| id         | ssn_b              |
 ----------------------------------
| 1          | U??6?7f%25(?????   |
 ---------------------------------

Configuration

You can customize Lucifer by passing options like so:

class Person < ActiveRecord::Base
  encrypt_attributes :suffix=>'_encrypted', :key_file=>'lucifer.yml'
end
  • :suffix - You can override the _b selector with this option

  • :key_file - If you'd like to use a different file in your config/ directory, pass the name here

Author

Something went wrong with that request. Please try again.