ork-encryption
The ork-encryption gem provides encryption and decryption for Ork models.
Dependencies
ork-encryption requires:
- Ruby 1.9 or later.
-
riak-clientto connect to Riak. -
ork0.1.1 or later.
Install Dependencies using dep is easy as run:
$ dep insatll
Installation
Install Riak with your package manager:
$ brew install riak
Or download it from Riak's download page
Once you have it installed, you can execute riak start and it will run on localhost:8098 by default.
If you don't have Ork-encryption, try this:
$ gem install ork-encryption
Overview
Any object that gets saved with content-type 'application/x-json-encrypted'
the Ork::Encryption::Serializers::Json will take care of load or unload the data from Riak.
Serializers::Json stores the encrypted data wrapped in JSON encapsulation so
that you can still introspect the Riak object and see which version of
this gem was used to encrypt it. As of version 0.0.1, this is now the only
supported serialization format for JSON data.
Getting started
You must initialize the Ork::Encryption module before using it.
Initialization needs a configuration hash with key and cipher to be used.
See how to choose the configuration
config = {
cipher: 'AES-256-CBC',
key: 'fantasticobscurekeygoesherenowty',
}
Ork::Encryption.init configThen include the Ork::Encryption module in your Ork::Document class:
class SomeDocument
include Ork::Document
include Ork::Encryption
attribute :message
endThese documents will now be stored encrypted and also the IV used.
Running the Tests
Adjust the variable to point to a test riak database. Default is http://localhost:8098
$ ORK_RIAK_URL='http://localhost:8198' rake