crypt_keeper 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -17
- data/crypt_keeper.gemspec +4 -4
- data/gemfiles/activerecord_3_0.gemfile.lock +17 -17
- data/gemfiles/activerecord_3_1.gemfile.lock +17 -17
- data/gemfiles/activerecord_3_2.gemfile.lock +17 -17
- data/lib/crypt_keeper/version.rb +1 -1
- metadata +12 -12
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
![CryptKeeper](http://i.imgur.com/qf0aD.jpg)
|
4
4
|
|
5
|
-
# CryptKeeper
|
5
|
+
# CryptKeeper
|
6
6
|
|
7
|
-
Provides transparent encryption for ActiveRecord. It is encryption agnostic.
|
7
|
+
Provides transparent encryption for ActiveRecord. It is encryption agnostic.
|
8
8
|
You can guard your data with any encryption algorithm you want. All you need
|
9
9
|
is a simple class that does 3 things.
|
10
10
|
|
@@ -12,14 +12,14 @@ is a simple class that does 3 things.
|
|
12
12
|
2. Provides an `encrypt` method that returns the encrypted string
|
13
13
|
3. Provides a `decrypt` method that returns the plaintext
|
14
14
|
|
15
|
-
Note: Any options defined using `crypt_keeper` will be passed to `new` as a
|
15
|
+
Note: Any options defined using `crypt_keeper` will be passed to `new` as a
|
16
16
|
hash.
|
17
17
|
|
18
18
|
You can see an AES example [here](https://github.com/jmazzi/crypt_keeper_providers/blob/master/lib/crypt_keeper_providers/aes.rb).
|
19
19
|
|
20
20
|
## Why?
|
21
21
|
|
22
|
-
The options available were either too complicated under the hood or had weird
|
22
|
+
The options available were either too complicated under the hood or had weird
|
23
23
|
edge cases that made the library hard to use. I wanted to write something
|
24
24
|
simple that *just works*.
|
25
25
|
|
@@ -35,26 +35,27 @@ model.save! #=> Your data is now encrypted
|
|
35
35
|
model.field #=> 'sometext'
|
36
36
|
```
|
37
37
|
|
38
|
-
It works with all persistences methods: `update_attributes`, `create`, `save`
|
38
|
+
It works with all persistences methods: `update_attributes`, `create`, `save`
|
39
39
|
etc.
|
40
40
|
|
41
41
|
Note: `update_attribute` is deprecated in ActiveRecord 3.2.7. It is superseded
|
42
|
-
by [update_column](http://apidock.com/rails/ActiveRecord/Persistence/update_column)
|
42
|
+
by [update_column](http://apidock.com/rails/ActiveRecord/Persistence/update_column)
|
43
|
+
which _skips_ all validations, callbacks.
|
43
44
|
|
44
|
-
That means using `update_column` will not perform any encryption. This is
|
45
|
-
expected behavior, and has
|
45
|
+
That means using `update_column` will not perform any encryption. This is
|
46
|
+
expected behavior, and has its use cases. An example would be migrating from
|
46
47
|
one type of encryption to another. Using `update_column` would allow you to
|
47
48
|
update the content without going through the current encryptor.
|
48
49
|
|
49
50
|
## Creating your own encryptor
|
50
51
|
|
51
|
-
Creating your own encryptor is easy. All you have to do is create a class
|
52
|
+
Creating your own encryptor is easy. All you have to do is create a class
|
52
53
|
under the `CryptKeeperProviders` namespace, like this:
|
53
54
|
|
54
55
|
```ruby
|
55
56
|
module CryptKeeperProviders
|
56
57
|
class MyEncryptor
|
57
|
-
def initialize(options ={})
|
58
|
+
def initialize(options = {})
|
58
59
|
end
|
59
60
|
|
60
61
|
def encrypt(value)
|
@@ -70,7 +71,6 @@ end
|
|
70
71
|
Just require your code and setup your model to use it. Just pass the class name
|
71
72
|
as a string or an underscored symbol
|
72
73
|
|
73
|
-
|
74
74
|
```ruby
|
75
75
|
class MyModel < ActiveRecord::Base
|
76
76
|
crypt_keeper :field, :other_field, :encryptor => :my_encryptor, :key => 'super_good_password'
|
@@ -79,19 +79,21 @@ end
|
|
79
79
|
|
80
80
|
## Available Encryptors
|
81
81
|
|
82
|
-
There are two included encryptors.
|
82
|
+
There are two included encryptors.
|
83
83
|
|
84
84
|
* [AES](https://github.com/jmazzi/crypt_keeper_providers/blob/master/lib/crypt_keeper_providers/aes.rb)
|
85
85
|
* Encryption is peformed using AES-256 via OpenSSL.
|
86
86
|
|
87
|
-
* [PostgreSQL PGP](https://github.com/jmazzi/crypt_keeper_providers/blob/master/lib/crypt_keeper_providers/postgres_pgp.rb).
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
* [PostgreSQL PGP](https://github.com/jmazzi/crypt_keeper_providers/blob/master/lib/crypt_keeper_providers/postgres_pgp.rb).
|
88
|
+
* Encryption is performed using PostgresSQL's native [PGP functions](http://www.postgresql.org/docs/9.1/static/pgcrypto.html).
|
89
|
+
* It requires the `pgcrypto` PostgresSQL extension:
|
90
|
+
`CREATE EXTENSION IF NOT EXISTS pgcrypto`
|
91
|
+
* ActiveRecord logs are [automatically](https://github.com/jmazzi/crypt_keeper_providers/blob/master/lib/crypt_keeper_providers/postgres_pgp/log_subscriber.rb)
|
92
|
+
filtered for you to protect senitive data from being logged.
|
91
93
|
|
92
94
|
## Requirements
|
93
95
|
|
94
|
-
|
96
|
+
CryptKeeper has been tested against ActiveRecord 3.0, 3.1, and 3.2 using ruby
|
95
97
|
1.9.2, 1.9.3 and jruby in 1.9 mode.
|
96
98
|
|
97
99
|
## Installation
|
data/crypt_keeper.gemspec
CHANGED
@@ -17,12 +17,12 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.add_runtime_dependency 'activerecord', '>= 3.0'
|
19
19
|
gem.add_runtime_dependency 'activesupport', '>= 3.0'
|
20
|
-
gem.add_runtime_dependency 'crypt_keeper_providers', '~> 0.
|
20
|
+
gem.add_runtime_dependency 'crypt_keeper_providers', '~> 0.5.1'
|
21
21
|
gem.add_runtime_dependency 'appraisal', '~> 0.4.1'
|
22
22
|
|
23
|
-
gem.add_development_dependency 'rspec', '~> 2.
|
24
|
-
gem.add_development_dependency 'guard', '~> 1.
|
25
|
-
gem.add_development_dependency 'guard-rspec', '~> 1.
|
23
|
+
gem.add_development_dependency 'rspec', '~> 2.11.0'
|
24
|
+
gem.add_development_dependency 'guard', '~> 1.3.0'
|
25
|
+
gem.add_development_dependency 'guard-rspec', '~> 1.2.0'
|
26
26
|
gem.add_development_dependency 'rake', '~> 0.9.2.2'
|
27
27
|
|
28
28
|
if RUBY_PLATFORM == 'java'
|
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /home/justin/work/ruby/crypt_keeper
|
3
3
|
specs:
|
4
|
-
crypt_keeper (0.
|
4
|
+
crypt_keeper (0.4.1)
|
5
5
|
activerecord (>= 3.0)
|
6
6
|
activesupport (>= 3.0)
|
7
7
|
appraisal (~> 0.4.1)
|
8
|
-
crypt_keeper_providers (~> 0.1
|
8
|
+
crypt_keeper_providers (~> 0.5.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -26,13 +26,13 @@ GEM
|
|
26
26
|
rake
|
27
27
|
arel (3.0.2)
|
28
28
|
builder (3.0.0)
|
29
|
-
crypt_keeper_providers (0.1
|
29
|
+
crypt_keeper_providers (0.5.1)
|
30
30
|
diff-lcs (1.1.3)
|
31
|
-
ffi (1.1.
|
32
|
-
guard (1.2
|
31
|
+
ffi (1.1.5)
|
32
|
+
guard (1.3.2)
|
33
33
|
listen (>= 0.4.2)
|
34
34
|
thor (>= 0.14.6)
|
35
|
-
guard-rspec (1.1
|
35
|
+
guard-rspec (1.2.1)
|
36
36
|
guard (>= 1.1)
|
37
37
|
i18n (0.6.0)
|
38
38
|
listen (0.4.7)
|
@@ -46,16 +46,16 @@ GEM
|
|
46
46
|
rb-fsevent (0.9.1)
|
47
47
|
rb-inotify (0.8.8)
|
48
48
|
ffi (>= 0.5.0)
|
49
|
-
rspec (2.
|
50
|
-
rspec-core (~> 2.
|
51
|
-
rspec-expectations (~> 2.
|
52
|
-
rspec-mocks (~> 2.
|
53
|
-
rspec-core (2.
|
54
|
-
rspec-expectations (2.
|
49
|
+
rspec (2.11.0)
|
50
|
+
rspec-core (~> 2.11.0)
|
51
|
+
rspec-expectations (~> 2.11.0)
|
52
|
+
rspec-mocks (~> 2.11.0)
|
53
|
+
rspec-core (2.11.1)
|
54
|
+
rspec-expectations (2.11.2)
|
55
55
|
diff-lcs (~> 1.1.3)
|
56
|
-
rspec-mocks (2.
|
56
|
+
rspec-mocks (2.11.2)
|
57
57
|
sqlite3 (1.3.6)
|
58
|
-
thor (0.
|
58
|
+
thor (0.16.0)
|
59
59
|
tzinfo (0.3.33)
|
60
60
|
|
61
61
|
PLATFORMS
|
@@ -65,8 +65,8 @@ DEPENDENCIES
|
|
65
65
|
activerecord (~> 3.0)
|
66
66
|
activesupport (~> 3.0)
|
67
67
|
crypt_keeper!
|
68
|
-
guard (~> 1.
|
69
|
-
guard-rspec (~> 1.
|
68
|
+
guard (~> 1.3.0)
|
69
|
+
guard-rspec (~> 1.2.0)
|
70
70
|
rake (~> 0.9.2.2)
|
71
|
-
rspec (~> 2.
|
71
|
+
rspec (~> 2.11.0)
|
72
72
|
sqlite3
|
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /home/justin/work/ruby/crypt_keeper
|
3
3
|
specs:
|
4
|
-
crypt_keeper (0.
|
4
|
+
crypt_keeper (0.4.1)
|
5
5
|
activerecord (>= 3.0)
|
6
6
|
activesupport (>= 3.0)
|
7
7
|
appraisal (~> 0.4.1)
|
8
|
-
crypt_keeper_providers (~> 0.1
|
8
|
+
crypt_keeper_providers (~> 0.5.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -26,13 +26,13 @@ GEM
|
|
26
26
|
rake
|
27
27
|
arel (3.0.2)
|
28
28
|
builder (3.0.0)
|
29
|
-
crypt_keeper_providers (0.1
|
29
|
+
crypt_keeper_providers (0.5.1)
|
30
30
|
diff-lcs (1.1.3)
|
31
|
-
ffi (1.1.
|
32
|
-
guard (1.2
|
31
|
+
ffi (1.1.5)
|
32
|
+
guard (1.3.2)
|
33
33
|
listen (>= 0.4.2)
|
34
34
|
thor (>= 0.14.6)
|
35
|
-
guard-rspec (1.1
|
35
|
+
guard-rspec (1.2.1)
|
36
36
|
guard (>= 1.1)
|
37
37
|
i18n (0.6.0)
|
38
38
|
listen (0.4.7)
|
@@ -46,16 +46,16 @@ GEM
|
|
46
46
|
rb-fsevent (0.9.1)
|
47
47
|
rb-inotify (0.8.8)
|
48
48
|
ffi (>= 0.5.0)
|
49
|
-
rspec (2.
|
50
|
-
rspec-core (~> 2.
|
51
|
-
rspec-expectations (~> 2.
|
52
|
-
rspec-mocks (~> 2.
|
53
|
-
rspec-core (2.
|
54
|
-
rspec-expectations (2.
|
49
|
+
rspec (2.11.0)
|
50
|
+
rspec-core (~> 2.11.0)
|
51
|
+
rspec-expectations (~> 2.11.0)
|
52
|
+
rspec-mocks (~> 2.11.0)
|
53
|
+
rspec-core (2.11.1)
|
54
|
+
rspec-expectations (2.11.2)
|
55
55
|
diff-lcs (~> 1.1.3)
|
56
|
-
rspec-mocks (2.
|
56
|
+
rspec-mocks (2.11.2)
|
57
57
|
sqlite3 (1.3.6)
|
58
|
-
thor (0.
|
58
|
+
thor (0.16.0)
|
59
59
|
tzinfo (0.3.33)
|
60
60
|
|
61
61
|
PLATFORMS
|
@@ -65,8 +65,8 @@ DEPENDENCIES
|
|
65
65
|
activerecord (~> 3.1)
|
66
66
|
activesupport (~> 3.1)
|
67
67
|
crypt_keeper!
|
68
|
-
guard (~> 1.
|
69
|
-
guard-rspec (~> 1.
|
68
|
+
guard (~> 1.3.0)
|
69
|
+
guard-rspec (~> 1.2.0)
|
70
70
|
rake (~> 0.9.2.2)
|
71
|
-
rspec (~> 2.
|
71
|
+
rspec (~> 2.11.0)
|
72
72
|
sqlite3
|
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /home/justin/work/ruby/crypt_keeper
|
3
3
|
specs:
|
4
|
-
crypt_keeper (0.
|
4
|
+
crypt_keeper (0.4.1)
|
5
5
|
activerecord (>= 3.0)
|
6
6
|
activesupport (>= 3.0)
|
7
7
|
appraisal (~> 0.4.1)
|
8
|
-
crypt_keeper_providers (~> 0.1
|
8
|
+
crypt_keeper_providers (~> 0.5.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -26,13 +26,13 @@ GEM
|
|
26
26
|
rake
|
27
27
|
arel (3.0.2)
|
28
28
|
builder (3.0.0)
|
29
|
-
crypt_keeper_providers (0.1
|
29
|
+
crypt_keeper_providers (0.5.1)
|
30
30
|
diff-lcs (1.1.3)
|
31
|
-
ffi (1.1.
|
32
|
-
guard (1.2
|
31
|
+
ffi (1.1.5)
|
32
|
+
guard (1.3.2)
|
33
33
|
listen (>= 0.4.2)
|
34
34
|
thor (>= 0.14.6)
|
35
|
-
guard-rspec (1.1
|
35
|
+
guard-rspec (1.2.1)
|
36
36
|
guard (>= 1.1)
|
37
37
|
i18n (0.6.0)
|
38
38
|
listen (0.4.7)
|
@@ -46,16 +46,16 @@ GEM
|
|
46
46
|
rb-fsevent (0.9.1)
|
47
47
|
rb-inotify (0.8.8)
|
48
48
|
ffi (>= 0.5.0)
|
49
|
-
rspec (2.
|
50
|
-
rspec-core (~> 2.
|
51
|
-
rspec-expectations (~> 2.
|
52
|
-
rspec-mocks (~> 2.
|
53
|
-
rspec-core (2.
|
54
|
-
rspec-expectations (2.
|
49
|
+
rspec (2.11.0)
|
50
|
+
rspec-core (~> 2.11.0)
|
51
|
+
rspec-expectations (~> 2.11.0)
|
52
|
+
rspec-mocks (~> 2.11.0)
|
53
|
+
rspec-core (2.11.1)
|
54
|
+
rspec-expectations (2.11.2)
|
55
55
|
diff-lcs (~> 1.1.3)
|
56
|
-
rspec-mocks (2.
|
56
|
+
rspec-mocks (2.11.2)
|
57
57
|
sqlite3 (1.3.6)
|
58
|
-
thor (0.
|
58
|
+
thor (0.16.0)
|
59
59
|
tzinfo (0.3.33)
|
60
60
|
|
61
61
|
PLATFORMS
|
@@ -65,8 +65,8 @@ DEPENDENCIES
|
|
65
65
|
activerecord (~> 3.2)
|
66
66
|
activesupport (~> 3.2)
|
67
67
|
crypt_keeper!
|
68
|
-
guard (~> 1.
|
69
|
-
guard-rspec (~> 1.
|
68
|
+
guard (~> 1.3.0)
|
69
|
+
guard-rspec (~> 1.2.0)
|
70
70
|
rake (~> 0.9.2.2)
|
71
|
-
rspec (~> 2.
|
71
|
+
rspec (~> 2.11.0)
|
72
72
|
sqlite3
|
data/lib/crypt_keeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crypt_keeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.5.1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.5.1
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: appraisal
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 2.
|
85
|
+
version: 2.11.0
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 2.
|
93
|
+
version: 2.11.0
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: guard
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 1.
|
101
|
+
version: 1.3.0
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.
|
109
|
+
version: 1.3.0
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: guard-rspec
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.2.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.
|
125
|
+
version: 1.2.0
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rake
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
segments:
|
201
201
|
- 0
|
202
|
-
hash:
|
202
|
+
hash: -1515318073958549095
|
203
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
204
|
none: false
|
205
205
|
requirements:
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
segments:
|
210
210
|
- 0
|
211
|
-
hash:
|
211
|
+
hash: -1515318073958549095
|
212
212
|
requirements: []
|
213
213
|
rubyforge_project:
|
214
214
|
rubygems_version: 1.8.23
|