Sha256: e3d303ff84b1ee4214bc025c5165be44e6c23788d2cd23a55ed9cb2c35e8c297

Contents?: true

Size: 1.32 KB

Versions: 22

Compression:

Stored size: 1.32 KB

Contents

# Mongoid::Kms

Easily encrypt your datas using AWS's KSM.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mongoid-kms'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mongoid-kms

## Usage

Environmental variables to include:

```
AWS_ACCESS_KEY_ID # an IAM access key
AWS_SECRET_ACCESS_KEY # an IAM access secret
```

Somewhere before your run your application, you will need to add this:

```ruby
require 'mongoid/kms'

Mongoid::Kms.configure({region: "us-east-1", key: "your aws kms key id i.e <02342-234-232-234-234>"})
```

When defining your classes, `include Mongoid::Kms`, and use the
`secure_field` to define your fields.  The `:context` argument is an
optional list of method names or strings used for encrypting your
values.

The context argument is an important way to ensure simply having the
authentication keys and data field does not enable decryption.  When
using context, it also requires an attacker to know the decryption
context.

```ruby
class MyClass
  include Mongoid::Document
  include Mongoid::Kms

  secure_field :my_secure_field, type: String, context: [:unsecure_field, "some-string"]
  field :unsecure_field
end
```

## Development and Testing

In development or testing, just require `mongoid/kms/mock` and the
package will use Rot13 for encryption.

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
mongoid-kms-0.0.35 README.md
mongoid-kms-0.1.4 README.md
mongoid-kms-0.1.3 README.md
mongoid-kms-0.1.2 README.md
mongoid-kms-0.0.34 README.md
mongoid-kms-0.0.33 README.md
mongoid-kms-0.0.32 README.md
mongoid-kms-0.0.31 README.md
mongoid-kms-0.0.30 README.md
mongoid-kms-0.0.29 README.md
mongoid-kms-0.0.28 README.md
mongoid-kms-0.0.27 README.md
mongoid-kms-0.0.26 README.md
mongoid-kms-0.0.25 README.md
mongoid-kms-0.0.24 README.md
mongoid-kms-0.0.23 README.md
mongoid-kms-0.0.22 README.md
mongoid-kms-0.0.21 README.md
mongoid-kms-0.0.20 README.md
mongoid-kms-0.0.19 README.md