Module: ActiveCrypto::ClassMethods

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.

## License

ActiveCrypto and EzCrypto are released under the MIT license.

## Support

To contact the author, send mail to pelleb@gmail.com

Also see my blogs at: stakeventures.com and neubia.com

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

(C) 2005 Pelle Braendgaard

### Methods

encrypt keyholder

### Included Modules

ActiveCrypto::Encrypted ActiveCrypto::AssociationKeyHolder

### Public Instance methods

encrypt(*attributes)

Turn encryption on for this record. List all encrypted attributes

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

Options are:

      <tt>key</tt> - to specify an external KeyHolder, which holds the key used for encrypting and decrypting
      <tt>base64</tt> - set to true in order to base64 encode the encrypted attributes.  defaults to false

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

keyholder()

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
            keyholder
      end

[Validate]