Module ActiveCrypto::ClassMethods
In: lib/active_crypto.rb

Usage is very simple. You will generally only need the two class methods listed here in your ActiveRecord class model.


ActiveCrypto and EzCrypto are released under the MIT license.


To contact the author, send mail to

Also see my blogs at: and

This project was based on code used in my project StakeItOut, where you can securely share web services with your partners.

(C) 2005 Pelle Braendgaard


encrypt   keyholder  

Included Modules

ActiveCrypto::Encrypted ActiveCrypto::AssociationKeyHolder

Public Instance methods

Turn encryption on for this record. List all encrypted attributes

  class Document < ActiveRecord::Base
                encrypt :title,:body

Include optional option :key, to specify an external KeyHolder, which holds the key used for encrypting and decrypting:

  class Document < ActiveRecord::Base
        belongs_to :user
        encrypt :title,:body,:key=>:user

Creates support in this class for holding a key. Adds the following methods:

  • enter_password(password,salt="onetwothree")
  • set_session_key(key)
  • session_key

Use it as follows:

  class User < ActiveRecord::Base
        has_many :documents