Thanks to visit codestin.com
Credit goes to github.com

Skip to content

coreymartella/lucifer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

This is a fork of Jordan McKible’s implementation (github.com/jmckible/lucifer) that uses base64 encoding instead of binary.

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

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

Add Lucifer to a class like so:

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

Lucifer will treat any binary column that ends in _encrypted 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_encrypted             |
 -----------------------------------------
| 1          | VY+7NpM3ZiUohaDNH7TDFA==  |
 -----------------------------------------

You can customize Lucifer by passing options like so:

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

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

About

Rails plugin to transparently encrypt attributes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%