crypt_keeper_providers 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/crypt_keeper_providers/aes.rb +4 -2
- data/lib/crypt_keeper_providers/version.rb +1 -1
- data/spec/aes_spec.rb +1 -1
- metadata +47 -39
@@ -4,6 +4,8 @@ require 'base64'
|
|
4
4
|
|
5
5
|
module CryptKeeperProviders
|
6
6
|
class Aes
|
7
|
+
SEPARATOR = ":crypt_keeper:"
|
8
|
+
|
7
9
|
attr_accessor :key, :aes
|
8
10
|
|
9
11
|
# Public: Initializes the class
|
@@ -25,7 +27,7 @@ module CryptKeeperProviders
|
|
25
27
|
aes.key = key
|
26
28
|
iv = rand.to_s
|
27
29
|
aes.iv = iv
|
28
|
-
Base64::encode64("#{iv}
|
30
|
+
Base64::encode64("#{iv}#{SEPARATOR}#{aes.update(value) + aes.final}")
|
29
31
|
end
|
30
32
|
|
31
33
|
# Public: Decrypt a string
|
@@ -33,7 +35,7 @@ module CryptKeeperProviders
|
|
33
35
|
# Returns a string
|
34
36
|
def decrypt(value)
|
35
37
|
value = Base64::decode64(value.to_s)
|
36
|
-
iv, value = value.split(
|
38
|
+
iv, value = value.split(SEPARATOR)
|
37
39
|
aes.decrypt
|
38
40
|
aes.key = key
|
39
41
|
aes.iv = iv
|
data/spec/aes_spec.rb
CHANGED
@@ -28,7 +28,7 @@ module CryptKeeperProviders
|
|
28
28
|
|
29
29
|
describe "#decrypt" do
|
30
30
|
let(:decrypted) do
|
31
|
-
subject.decrypt "
|
31
|
+
subject.decrypt "MC41MDk5MjI2NjgxMDI1MDI2OmNyeXB0X2tlZXBlcjpPI/8dCqWXDMVj7Jqs\nuwf/\n"
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should decrypt the string" do
|
metadata
CHANGED
@@ -1,71 +1,80 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crypt_keeper_providers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Justin Mazzi
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-27 00:00:00.
|
12
|
+
date: 2012-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
17
18
|
requirements:
|
18
19
|
- - ~>
|
19
20
|
- !ruby/object:Gem::Version
|
20
21
|
version: 2.10.0
|
21
|
-
none: false
|
22
|
-
requirement: *4650
|
23
|
-
prerelease: false
|
24
22
|
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.10.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: guard
|
27
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
28
34
|
requirements:
|
29
35
|
- - ~>
|
30
36
|
- !ruby/object:Gem::Version
|
31
37
|
version: 1.2.0
|
32
|
-
none: false
|
33
|
-
requirement: *4668
|
34
|
-
prerelease: false
|
35
38
|
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: guard-rspec
|
38
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
39
50
|
requirements:
|
40
51
|
- - ~>
|
41
52
|
- !ruby/object:Gem::Version
|
42
53
|
version: 1.1.0
|
43
|
-
none: false
|
44
|
-
requirement: *4684
|
45
|
-
prerelease: false
|
46
54
|
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rake
|
49
|
-
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
50
66
|
requirements:
|
51
67
|
- - ~>
|
52
68
|
- !ruby/object:Gem::Version
|
53
69
|
version: 0.9.2.2
|
54
|
-
none: false
|
55
|
-
requirement: *4700
|
56
|
-
prerelease: false
|
57
70
|
type: :development
|
58
|
-
|
59
|
-
|
60
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
61
74
|
requirements:
|
62
75
|
- - ~>
|
63
76
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.
|
65
|
-
none: false
|
66
|
-
requirement: *4716
|
67
|
-
prerelease: false
|
68
|
-
type: :development
|
77
|
+
version: 0.9.2.2
|
69
78
|
description: Encryption providers for crypt_keeper
|
70
79
|
email:
|
71
80
|
- jmazzi@gmail.com
|
@@ -89,35 +98,34 @@ files:
|
|
89
98
|
- spec/spec_helper.rb
|
90
99
|
homepage: ''
|
91
100
|
licenses: []
|
92
|
-
post_install_message:
|
101
|
+
post_install_message:
|
93
102
|
rdoc_options: []
|
94
103
|
require_paths:
|
95
104
|
- lib
|
96
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
97
107
|
requirements:
|
98
108
|
- - ! '>='
|
99
109
|
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
100
111
|
segments:
|
101
112
|
- 0
|
102
|
-
hash:
|
103
|
-
version: '0'
|
104
|
-
none: false
|
113
|
+
hash: 2013321014928306756
|
105
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
106
116
|
requirements:
|
107
117
|
- - ! '>='
|
108
118
|
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
109
120
|
segments:
|
110
121
|
- 0
|
111
|
-
hash:
|
112
|
-
version: '0'
|
113
|
-
none: false
|
122
|
+
hash: 2013321014928306756
|
114
123
|
requirements: []
|
115
|
-
rubyforge_project:
|
116
|
-
rubygems_version: 1.8.
|
117
|
-
signing_key:
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 1.8.23
|
126
|
+
signing_key:
|
118
127
|
specification_version: 3
|
119
128
|
summary: Encryption providers for crypt_keeper
|
120
129
|
test_files:
|
121
130
|
- spec/aes_spec.rb
|
122
131
|
- spec/spec_helper.rb
|
123
|
-
...
|