0.0
No commit activity in last 3 years
No release in over 3 years
Encryption and decryption of a model’s properties.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.12
~> 10.0
~> 3.0
 Project Readme

Active Crypto

Build Status Gem Version

Encryption and decryption of a model's properties (Rails 4.1+, OpenSSL)

NOTE: Default key will be used from the secrets.yml file

Installation

Add this line to your application's Gemfile:

gem 'activecrypto'

And then execute:

$ bundle

Next, you need to run the generator:

$ rails g crypto:install

Usage

# app/models/user.rb
class User < ActiveRecord::Base
  # basic encrypt (default AES-256-CBC)
  encrypt :column_name
  ...
end

Or with with custom cipher like AES-256-CBC

class User < ActiveRecord::Base
  encrypt :column_name, { cipher: 'AES', block_mode: 'CBC', keylength: 256 }
  ...
end

If you need to choose an encryption algorithm. You can see the full list with:

ruby -r openssl -e 'puts OpenSSL::Cipher.ciphers'

People

The big thanks goes to Ben Poweski & David Raphael

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mtunjic/activecrypto.

License

The gem is available as open source under the terms of the MIT License.