spikex-strongbox 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/init.rb +1 -0
- data/lib/strongbox/lock.rb +1 -1
- data/lib/strongbox.rb +1 -1
- data/test/strongbox_test.rb +16 -1
- metadata +2 -1
data/Rakefile
CHANGED
@@ -31,7 +31,7 @@ spec = Gem::Specification.new do |s|
|
|
31
31
|
s.authors = ["Spike Ilacqua"]
|
32
32
|
s.email = "spike@stuff-things.net"
|
33
33
|
s.homepage = "http://stuff-things.net/strongbox"
|
34
|
-
s.files = FileList["[A-Z]*", "{lib,rails,test}/**/*"]
|
34
|
+
s.files = FileList["[A-Z]*", "init.rb", "{lib,rails,test}/**/*"]
|
35
35
|
s.add_development_dependency 'thoughtbot-shoulda'
|
36
36
|
end
|
37
37
|
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'strongbox'
|
data/lib/strongbox/lock.rb
CHANGED
@@ -64,7 +64,7 @@ module Strongbox
|
|
64
64
|
ciphertext = Base64.decode64(ciphertext) if @base64
|
65
65
|
private_key = OpenSSL::PKey::RSA.new(File.read(@private_key),password)
|
66
66
|
if @symmetric == :always
|
67
|
-
cipher = OpenSSL::Cipher::Cipher.new(
|
67
|
+
cipher = OpenSSL::Cipher::Cipher.new(@symmetric_cipher)
|
68
68
|
cipher.decrypt
|
69
69
|
cipher.key = private_key.private_decrypt(@instance.read_attribute(@symmetric_key),@padding)
|
70
70
|
cipher.iv = private_key.private_decrypt(@instance.read_attribute(@symmetric_iv),@padding)
|
data/lib/strongbox.rb
CHANGED
data/test/strongbox_test.rb
CHANGED
@@ -79,10 +79,25 @@ class StrongboxTest < Test::Unit::TestCase
|
|
79
79
|
should 'Base64 encode the ciphertext' do
|
80
80
|
# Base64 encoded text is limited to the charaters A–Z, a–z, and 0–9,
|
81
81
|
# and is padded with 0 to 2 equal-signs
|
82
|
-
|
82
|
+
assert_match /^[0-9A-Za-z+\/]+={0,2}$/, @dummy.attributes['secret']
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
context "using blowfish cipher instead of AES" do
|
88
|
+
setup do
|
89
|
+
rebuild_class(:key_pair => File.join(FIXTURES_DIR,'keypair.pem'),
|
90
|
+
:symmetric_cipher => 'bf-cbc')
|
91
|
+
@dummy = Dummy.new
|
92
|
+
@dummy.secret = 'Shhhh'
|
93
|
+
end
|
94
|
+
|
95
|
+
should "encrypt the data" do
|
96
|
+
assert_not_equal @dummy.attributes['secret'], 'Shhhh'
|
97
|
+
assert_equal "*encrypted*", @dummy.secret.decrypt
|
98
|
+
assert_equal "Shhhh", @dummy.secret.decrypt('boost facile')
|
99
|
+
end
|
100
|
+
end
|
86
101
|
end
|
87
102
|
|
88
103
|
context "when a key_pair is not provided" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spikex-strongbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spike Ilacqua
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- LICENSE
|
35
35
|
- Rakefile
|
36
36
|
- README.textile
|
37
|
+
- init.rb
|
37
38
|
- lib/strongbox
|
38
39
|
- lib/strongbox/lock.rb
|
39
40
|
- lib/strongbox.rb
|