pluginaweek-encrypted_strings 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +59 -0
- data/LICENSE +20 -0
- data/README.rdoc +88 -0
- data/Rakefile +96 -0
- data/init.rb +1 -0
- data/lib/encrypted_strings.rb +7 -0
- data/lib/encrypted_strings/asymmetric_cipher.rb +185 -0
- data/lib/encrypted_strings/cipher.rb +17 -0
- data/lib/encrypted_strings/extensions/string.rb +205 -0
- data/lib/encrypted_strings/sha_cipher.rb +67 -0
- data/lib/encrypted_strings/symmetric_cipher.rb +101 -0
- data/test/asymmetric_cipher_test.rb +183 -0
- data/test/cipher_test.rb +15 -0
- data/test/keys/encrypted_private +12 -0
- data/test/keys/private +9 -0
- data/test/keys/public +4 -0
- data/test/sha_cipher_test.rb +82 -0
- data/test/string_test.rb +222 -0
- data/test/symmetric_cipher_test.rb +99 -0
- data/test/test_helper.rb +4 -0
- metadata +79 -0
data/test/cipher_test.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class CipherByDefaultTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@cipher = EncryptedStrings::Cipher.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_should_be_able_to_decrypt_by_default
|
9
|
+
assert @cipher.can_decrypt?
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_raise_exception_if_decrypt_not_implemented
|
13
|
+
assert_raises(NotImplementedError) {@cipher.decrypt('test')}
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
TGr8Jm/7zh1dfjjoNJtOncvX/BdUL47b8k2rQbMTY7VD6ZpD317NTuVX1hHV
|
2
|
+
54Nm6pnCId5wcga3sI3TqolTxkqKBy7Rb1mPVBeJyd7ZuoD7zp65+ws+o4Lr
|
3
|
+
Xn/3WculfuThUnDESqD53vnKPCfRK6hoMDygEV7urmuide5ogpZp52lidUku
|
4
|
+
cXOHDqfVETX7NNnHHghg/6qDUX7+0qf+XeKe8uiI0cPoE5YFnOHyF7oOBGtR
|
5
|
+
IqJG97q1InCJMeAbMSxcjO71Te51Z098yI+XN4rGmXbmzSrVKHMUk0tdsVxi
|
6
|
+
CE5OmnzLeXK1xomxkRmXZzl10WDBn9e4knoLJTlDdNR3fA4gLRfy3r6RBlDl
|
7
|
+
j7HI53o5gi9PTshSXwHr6Q8SV9fty2Nz3/yRT/ZPLUJC1GUqErLl2j6zYbVR
|
8
|
+
8YMaLt1Zqi79ycPZxZV4Zh57YE86nUqepS1pzVpcS8dHZMne846lTyaOyxZ8
|
9
|
+
dxW+18s7E7KqpHj17QYrF6c7R5ZHgoNAbLFeGSUCXqkW8YdyidLqQTzWN7hF
|
10
|
+
roVcZWFe8YfSUKmgndVBOHGHxMGr+OYgVdAStOEwmRHaNGgSBE4FCkKXYJUj
|
11
|
+
ec3zNpiOCb8zxfNku5nT5nIHnGqO4JKWDvDGVioV+ffHwXpAw3OFE5n+M/uo
|
12
|
+
4ZZbVSh1qZxd
|
data/test/keys/private
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIBOwIBAAJBAL/xeY6aqFx6z1ThNOwgPgxv3tsonTlCj8VkN3Ikumg6SzBuLxlV
|
3
|
+
i9gFQZ7K9Pv9o/7+xUTYODqBpVhwgLBeu2cCAwEAAQJAHyjFMfg7Yp/xLndMzxRA
|
4
|
+
3mX+yJckRtpeWo31TktWE3syks1r9OrfmxKiStM9kFRubeBHTihZrW92TYkROLxh
|
5
|
+
uQIhAPuftVTJZFDNxeYDKIMIMqwR8KZgtuf25cv4pTxYwPqLAiEAw0gNwDJHBkvo
|
6
|
+
da4402pZNQmBA6qCSf0svDXqoEoaShUCIGBma340Oe6LJ0pb42Vv+pnZtazIWMq9
|
7
|
+
2IQwmn1oM2bJAiEAhgP869mVRIzzi091UCG79tn+4DU0FPLasI+P5VD1mcECIQDb
|
8
|
+
3ndvbPcElVvdJgabxyWJJsNtBBNZYPsuc6NrQyShOw==
|
9
|
+
-----END RSA PRIVATE KEY-----
|
data/test/keys/public
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class ShaCipherByDefaulTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@sha_cipher = EncryptedStrings::ShaCipher.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_should_use_default_salt
|
9
|
+
assert_equal 'salt', @sha_cipher.salt
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_encrypt_using_default_salt
|
13
|
+
assert_equal 'f438229716cab43569496f3a3630b3727524b81b', @sha_cipher.encrypt('test')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ShaCipherWithCustomDefaultsTest < Test::Unit::TestCase
|
18
|
+
def setup
|
19
|
+
@original_default_salt = EncryptedStrings::ShaCipher.default_salt
|
20
|
+
EncryptedStrings::ShaCipher.default_salt = 'custom_salt'
|
21
|
+
@sha_cipher = EncryptedStrings::ShaCipher.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_should_use_custom_default_salt
|
25
|
+
assert_equal 'custom_salt', @sha_cipher.salt
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_should_encrypt_using_custom_default_salt
|
29
|
+
assert_equal '280f3c516070b09aa3eb755378509c725a9c6561', @sha_cipher.encrypt('test')
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown
|
33
|
+
EncryptedStrings::ShaCipher.default_salt = @original_default_salt
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class ShaCipherWithInvalidOptionsTest < Test::Unit::TestCase
|
38
|
+
def test_should_throw_an_exception
|
39
|
+
assert_raise(ArgumentError) {EncryptedStrings::ShaCipher.new(:invalid => true)}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class ShaCipherTest < Test::Unit::TestCase
|
44
|
+
def setup
|
45
|
+
@sha_cipher = EncryptedStrings::ShaCipher.new
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_should_not_be_able_to_decrypt
|
49
|
+
assert !EncryptedStrings::ShaCipher.new.can_decrypt?
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_raise_exception_if_trying_to_decrypt
|
53
|
+
assert_raises(NotImplementedError) {EncryptedStrings::ShaCipher.new.decrypt('test')}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class ShaCipherWithCustomOptionsTest < Test::Unit::TestCase
|
58
|
+
def setup
|
59
|
+
@sha_cipher = EncryptedStrings::ShaCipher.new(:salt => 'different salt')
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_should_use_custom_salt
|
63
|
+
assert_equal 'different salt', @sha_cipher.salt
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_should_encrypt_using_custom_salt
|
67
|
+
assert_equal '18e3256d71529db8fa65b2eef24a69ddad7070f3', @sha_cipher.encrypt('test')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class ShaCipherWithNonStringSaltTest < Test::Unit::TestCase
|
72
|
+
require 'time'
|
73
|
+
|
74
|
+
def setup
|
75
|
+
@time = Time.parse('Tue Jan 01 00:00:00 UTC 2008')
|
76
|
+
@sha_cipher = EncryptedStrings::ShaCipher.new(:salt => @time)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_should_stringify_salt
|
80
|
+
assert_equal @time.to_s, @sha_cipher.salt
|
81
|
+
end
|
82
|
+
end
|
data/test/string_test.rb
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class StringByDefaultTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@encrypted_string = 'test'.encrypt
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_should_use_sha
|
9
|
+
assert_instance_of EncryptedStrings::ShaCipher, @encrypted_string.cipher
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class StringWithCustomOptionsTest < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@encrypted_string = 'test'.encrypt(:salt => 'different_salt')
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_use_sha
|
19
|
+
assert_instance_of EncryptedStrings::ShaCipher, @encrypted_string.cipher
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_use_custom_options
|
23
|
+
assert_equal 'different_salt', @encrypted_string.cipher.salt
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class StringWithCustomCipher
|
28
|
+
def setup
|
29
|
+
@encrypted_string = 'test'.encrypt(:symmetric, :password => 'key')
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_should_use_custom_cipher
|
33
|
+
assert_instance_of EncryptedStrings::SymmetricCipher, @encrypted_string.cipher
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class StringTest < Test::Unit::TestCase
|
38
|
+
def setup
|
39
|
+
@string = 'test'
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_should_not_be_encrypted
|
43
|
+
assert !@string.encrypted?
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_not_have_a_cipher
|
47
|
+
assert_nil @string.cipher
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_should_not_be_able_to_decrypt
|
51
|
+
assert !@string.can_decrypt?
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class StringAfterBeingEncryptedTest < Test::Unit::TestCase
|
56
|
+
def setup
|
57
|
+
@encrypted_string = 'test'.encrypt
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_should_be_encrypted
|
61
|
+
assert @encrypted_string.encrypted?
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class StringAfterBeingEncryptedAndReplacedTest < Test::Unit::TestCase
|
66
|
+
def setup
|
67
|
+
@encrypted_string = 'string'
|
68
|
+
@encrypted_string.encrypt!
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_should_not_be_the_original_value
|
72
|
+
assert !'test'.equals_without_encryption(@encrypted_string)
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_should_have_a_cipher
|
76
|
+
assert_instance_of EncryptedStrings::ShaCipher, @encrypted_string.cipher
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_should_be_encrypted
|
80
|
+
assert @encrypted_string.encrypted?
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class StringAfterBeingDecryptedTest < Test::Unit::TestCase
|
85
|
+
def setup
|
86
|
+
@encrypted_string = 'test'.encrypt(:symmetric, :password => 'secret')
|
87
|
+
@decrypted_string = @encrypted_string.decrypt
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_should_not_be_encrypted
|
91
|
+
assert !@decrypted_string.encrypted?
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_should_not_have_a_cipher
|
95
|
+
assert_nil @decrypted_string.cipher
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class StringAfterBeingDecryptedAndReplacedTest < Test::Unit::TestCase
|
100
|
+
def setup
|
101
|
+
@encrypted_string = 'test'.encrypt(:symmetric, :password => 'secret')
|
102
|
+
@encrypted_string.decrypt!
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_should_not_be_the_original_value
|
106
|
+
assert !"oTxJd67ElLY=\n".equals_without_encryption(@encrypted_string)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_should_be_the_decrypted_value
|
110
|
+
assert 'test'.equals_without_encryption(@encrypted_string)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_should_not_have_a_cipher
|
114
|
+
assert_nil @encrypted_string.cipher
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_should_not_be_encrypted
|
118
|
+
assert !@encrypted_string.encrypted?
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
class StringWithUndecryptableCipherTest < Test::Unit::TestCase
|
123
|
+
def setup
|
124
|
+
@encrypted_string = 'test'.encrypt(:sha)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_should_not_be_able_to_decrypt
|
128
|
+
assert !@encrypted_string.can_decrypt?
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_should_raise_exception_if_decrypted
|
132
|
+
assert_raise(NotImplementedError) {@encrypted_string.decrypt}
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_should_be_able_to_check_equality_with_itself
|
136
|
+
assert_equal @encrypted_string, @encrypted_string
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_should_be_able_to_check_equality_with_unencrypted_string
|
140
|
+
assert_equal 'test', @encrypted_string
|
141
|
+
assert_equal @encrypted_string, 'test'
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_should_be_able_to_check_equality_with_encrypted_value_of_encrypted_string
|
145
|
+
encrypted_encrypted_string = @encrypted_string.encrypt(:sha)
|
146
|
+
|
147
|
+
assert_equal @encrypted_string, encrypted_encrypted_string
|
148
|
+
assert_equal encrypted_encrypted_string, @encrypted_string
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_should_be_able_to_check_equality_with_same_string_without_cipher
|
152
|
+
assert_equal @encrypted_string.to_s, @encrypted_string
|
153
|
+
assert_equal @encrypted_string, @encrypted_string.to_s
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_should_not_be_able_to_check_equality_more_than_one_encryption_away
|
157
|
+
encrypted_encrypted_string = @encrypted_string.encrypt(:sha)
|
158
|
+
|
159
|
+
assert_not_equal 'test', encrypted_encrypted_string
|
160
|
+
assert_not_equal encrypted_encrypted_string, 'test'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class StringWithDecryptableCipherTest < Test::Unit::TestCase
|
165
|
+
def setup
|
166
|
+
@encrypted_string = 'test'.encrypt(:symmetric, :password => 'secret')
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_should_be_able_to_decrypt
|
170
|
+
assert @encrypted_string.can_decrypt?
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_should_be_able_to_check_equality_with_itself
|
174
|
+
assert_equal @encrypted_string, @encrypted_string
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_should_be_able_to_check_equality_with_unencrypted_string
|
178
|
+
assert_equal 'test', @encrypted_string
|
179
|
+
assert_equal @encrypted_string, 'test'
|
180
|
+
end
|
181
|
+
|
182
|
+
def test_should_be_able_to_check_equality_with_encrypted_value_of_encrypted_string
|
183
|
+
encrypted_encrypted_string = @encrypted_string.encrypt(:symmetric, :password => 'secret')
|
184
|
+
|
185
|
+
assert_equal @encrypted_string, encrypted_encrypted_string
|
186
|
+
assert_equal encrypted_encrypted_string, @encrypted_string
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_should_be_able_to_check_equality_with_same_string_without_cipher
|
190
|
+
assert_equal @encrypted_string.to_s, @encrypted_string
|
191
|
+
assert_equal @encrypted_string, @encrypted_string.to_s
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_should_not_be_able_to_check_equality_more_than_one_encryption_away
|
195
|
+
encrypted_encrypted_string = @encrypted_string.encrypt(:symmetric, :password => 'secret')
|
196
|
+
|
197
|
+
assert_not_equal 'test', encrypted_encrypted_string
|
198
|
+
assert_not_equal encrypted_encrypted_string, 'test'
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
class StringPreviouslyEncryptedTest < Test::Unit::TestCase
|
203
|
+
def setup
|
204
|
+
@encrypted_string = "oTxJd67ElLY=\n"
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_should_not_be_encrypted
|
208
|
+
assert !@encrypted_string.encrypted?
|
209
|
+
end
|
210
|
+
|
211
|
+
def test_should_not_have_a_cipher
|
212
|
+
assert_nil @encrypted_string.cipher
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_should_not_be_able_to_decrypt
|
216
|
+
assert !@encrypted_string.can_decrypt?
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_should_be_able_to_decrypt_with_custom_mode
|
220
|
+
assert_equal 'test', @encrypted_string.decrypt(:symmetric, :password => 'secret')
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class NoPasswordErrorTest < Test::Unit::TestCase
|
4
|
+
def test_should_exist
|
5
|
+
assert_not_nil EncryptedStrings::NoPasswordError
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class SymmetricCipherByDefaultTest < Test::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
@symmetric_cipher = EncryptedStrings::SymmetricCipher.new(:password => 'secret')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_use_default_algorithm
|
15
|
+
assert_equal 'DES-EDE3-CBC', @symmetric_cipher.algorithm
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_raise_exception
|
19
|
+
assert_raise(EncryptedStrings::NoPasswordError) {EncryptedStrings::SymmetricCipher.new}
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_encrypt_using_default_configuration
|
23
|
+
assert_equal "oTxJd67ElLY=\n", @symmetric_cipher.encrypt('test')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_decrypt_encrypted_string_using_default_configuration
|
27
|
+
assert_equal 'test', @symmetric_cipher.decrypt("oTxJd67ElLY=\n")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class SymmetricCipherWithCustomDefaultsTest < Test::Unit::TestCase
|
32
|
+
def setup
|
33
|
+
@original_default_algorithm = EncryptedStrings::SymmetricCipher.default_algorithm
|
34
|
+
@original_default_password = EncryptedStrings::SymmetricCipher.default_password
|
35
|
+
|
36
|
+
EncryptedStrings::SymmetricCipher.default_algorithm = 'DES-EDE3-CFB'
|
37
|
+
EncryptedStrings::SymmetricCipher.default_password = 'secret'
|
38
|
+
@symmetric_cipher = EncryptedStrings::SymmetricCipher.new
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_should_use_custom_default_algorithm
|
42
|
+
assert_equal 'DES-EDE3-CFB', @symmetric_cipher.algorithm
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_should_use_custom_default_password
|
46
|
+
assert_equal 'secret', @symmetric_cipher.password
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_should_encrypt_using_custom_default_configuration
|
50
|
+
assert_equal "QWz/eQ==\n", @symmetric_cipher.encrypt('test')
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_should_decrypt_encrypted_string_using_custom_default_configuration
|
54
|
+
assert_equal 'test', @symmetric_cipher.decrypt("QWz/eQ==\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
def teardown
|
58
|
+
EncryptedStrings::SymmetricCipher.default_algorithm = @original_default_algorithm
|
59
|
+
EncryptedStrings::SymmetricCipher.default_password = @original_default_password
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class SymmetricCipherWithInvalidOptionsTest < Test::Unit::TestCase
|
64
|
+
def test_should_throw_an_exception
|
65
|
+
assert_raise(ArgumentError) {EncryptedStrings::SymmetricCipher.new(:invalid => true)}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class SymmetricCipherTest < Test::Unit::TestCase
|
70
|
+
def setup
|
71
|
+
@symmetric_cipher = EncryptedStrings::SymmetricCipher.new(:password => 'secret')
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_should_be_able_to_decrypt
|
75
|
+
assert @symmetric_cipher.can_decrypt?
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class SymmetricCipherWithCustomOptionsTest < Test::Unit::TestCase
|
80
|
+
def setup
|
81
|
+
@symmetric_cipher = EncryptedStrings::SymmetricCipher.new(:algorithm => 'DES-EDE3-CFB', :password => 'secret')
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_should_use_custom_algorithm
|
85
|
+
assert_equal 'DES-EDE3-CFB', @symmetric_cipher.algorithm
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_should_use_custom_password
|
89
|
+
assert_equal 'secret', @symmetric_cipher.password
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_should_encrypt_using_custom_options
|
93
|
+
assert_equal "QWz/eQ==\n", @symmetric_cipher.encrypt('test')
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_should_decrypt_using_custom_options
|
97
|
+
assert_equal 'test', @symmetric_cipher.decrypt("QWz/eQ==\n")
|
98
|
+
end
|
99
|
+
end
|