strongbox 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MGRhOGUwMmEzNWU0MjFmNDBkZDdhZTc3MDhkZjllZjM3NThmOTRlYw==
5
- data.tar.gz: !binary |-
6
- OTJkNGY2YTEyNjI5ZTVlMDE3NDY4ZDlhN2NhMGRjMTg4NjAxYTY5NA==
2
+ SHA1:
3
+ metadata.gz: 1571ce9f278af93d9d7353192e33b7e651149c5a
4
+ data.tar.gz: 5f99be65d0d775389c09e7de1a19d139cf14353d
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YzU2YzRhM2MxZjI3NWYzNWY4ZjMyZDRiODA5MGQzMDZjZWU3ZjNhNmExYmJi
10
- OWU1ODhiNDhmZDg4NzliMGZmNjZiNmUwYmE2YmQwMjk0ODE0MDczMWJjNTFl
11
- YzQ4MzdmZWQ5ZDc0Y2RkZWNkNzkxMDNhNzQ4M2YzYzZjNzEzYmE=
12
- data.tar.gz: !binary |-
13
- Mjg5Y2I3NDViYWFkM2ZmMzgxNDBlMjc3NzAxZWZmZTY3ZWUwZTc3MDQyMjg2
14
- MGRmNzU1YzgzNmRlYmRiODg5YTAzNTVjOGI0M2ZjZTg2ZDE5YjA3MTJmMGE3
15
- ZjFhYWFmY2NmOWY3NDZmOTE5YjI3NTNkMjU0Mzk2OGNiMjI5YWI=
6
+ metadata.gz: 9e1289c09e1f4c91cea61b9602558f89becfab9653ea278658936a6fc32af90ddedc7156263b13d1a091bdac57981460c6fe519556f58399faf5f79a6e119f11
7
+ data.tar.gz: 970cebde69c51b93cb76fccaa71d7d9c946a4f964a9e016994e191c45b809c48f8f313176d428722feeddd137a831b03643c5f3237c0b441bc31816aa5af42c0
@@ -0,0 +1 @@
1
+ 2.4.3
@@ -1,10 +1,16 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
4
- - 1.8.7
3
+ - 2.2.9
4
+ - 2.4.3
5
5
 
6
6
  gemfile:
7
- - gemfiles/2.3.gemfile
8
- - gemfiles/3.0.gemfile
9
- - gemfiles/3.1.gemfile
10
7
  - gemfiles/3.2.gemfile
8
+ - gemfiles/4.2.gemfile
9
+ - gemfiles/5.1.gemfile
10
+
11
+ matrix:
12
+ exclude:
13
+ - rvm: 1.9.3
14
+ gemfile: gemfiles/5.1.gemfile
15
+ - rvm: 2.4.3
16
+ gemfile: gemfiles/3.2.gemfile
@@ -0,0 +1,63 @@
1
+ # Change Log
2
+
3
+ ## [v0.7.2](https://github.com/spikex/strongbox/tree/v0.7.2) (2015-03-01)
4
+
5
+ **Closed issues:**
6
+
7
+ - string contains null byte [\#44](https://github.com/spikex/strongbox/issues/44)
8
+
9
+ - Validation before encryption? [\#41](https://github.com/spikex/strongbox/issues/41)
10
+
11
+ - How to avoid storing private key by re-generating it [\#39](https://github.com/spikex/strongbox/issues/39)
12
+
13
+ - Format validations failing [\#35](https://github.com/spikex/strongbox/issues/35)
14
+
15
+ - Using strongbox with NSS [\#34](https://github.com/spikex/strongbox/issues/34)
16
+
17
+ - Travis-CI [\#32](https://github.com/spikex/strongbox/issues/32)
18
+
19
+ - Allow empty encryption field [\#25](https://github.com/spikex/strongbox/issues/25)
20
+
21
+ - "stack level too deep" With Database Migration [\#22](https://github.com/spikex/strongbox/issues/22)
22
+
23
+ - dynamic :public\_key and :private\_key [\#20](https://github.com/spikex/strongbox/issues/20)
24
+
25
+ - Cannot visit Strongbox::Lock - error [\#18](https://github.com/spikex/strongbox/issues/18)
26
+
27
+ - 0.4.7 breaks rails 2.x [\#16](https://github.com/spikex/strongbox/issues/16)
28
+
29
+ - Deprecation Warning under Rails 3.1.0.rc4 [\#15](https://github.com/spikex/strongbox/issues/15)
30
+
31
+ - RSAError: data greater than mod len [\#14](https://github.com/spikex/strongbox/issues/14)
32
+
33
+ - to\_xml or to\_json support [\#11](https://github.com/spikex/strongbox/issues/11)
34
+
35
+ - No gemspec? [\#10](https://github.com/spikex/strongbox/issues/10)
36
+
37
+ **Merged pull requests:**
38
+
39
+ - Make validations well-behaved with :deferred\_encryption [\#45](https://github.com/spikex/strongbox/pull/45) ([jakub-](https://github.com/jakub-))
40
+
41
+ - Document deferred\_encryption option [\#43](https://github.com/spikex/strongbox/pull/43) ([hernan124](https://github.com/hernan124))
42
+
43
+ - Include nil encryption explanation in readme [\#33](https://github.com/spikex/strongbox/pull/33) ([nelsonblaha](https://github.com/nelsonblaha))
44
+
45
+ - Actually assert in validation helper functions and minor clean up of tests [\#31](https://github.com/spikex/strongbox/pull/31) ([Nitrodist](https://github.com/Nitrodist))
46
+
47
+ - Lock down versions to some version of a workable gemspec and fix rdoc [\#30](https://github.com/spikex/strongbox/pull/30) ([Nitrodist](https://github.com/Nitrodist))
48
+
49
+ - Update Readme.textile [\#28](https://github.com/spikex/strongbox/pull/28) ([nelsonblaha](https://github.com/nelsonblaha))
50
+
51
+ - Handle Keys When They Are a Pathname [\#26](https://github.com/spikex/strongbox/pull/26) ([jherdman](https://github.com/jherdman))
52
+
53
+ - Encryption in before save hook. [\#24](https://github.com/spikex/strongbox/pull/24) ([hron](https://github.com/hron))
54
+
55
+ - Fix a typo. [\#21](https://github.com/spikex/strongbox/pull/21) ([jmazzi](https://github.com/jmazzi))
56
+
57
+ - encrypt\_with\_public\_key can now handle multiply columns [\#19](https://github.com/spikex/strongbox/pull/19) ([oleander](https://github.com/oleander))
58
+
59
+ - Feature: optionally allow disabling of Lock#ensure\_required\_columns [\#9](https://github.com/spikex/strongbox/pull/9) ([whittle](https://github.com/whittle))
60
+
61
+
62
+
63
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/README.md CHANGED
@@ -212,7 +212,7 @@ only the public key.
212
212
  ```ruby
213
213
  require 'openssl'
214
214
  rsa_key = OpenSSL::PKey::RSA.new(2048)
215
- cipher = OpenSSL::Cipher::Cipher.new('des3')
215
+ cipher = OpenSSL::Cipher.new('des3')
216
216
  private_key = rsa_key.to_pem(cipher,'password')
217
217
  public_key = rsa_key.public_key.to_pem
218
218
  key_pair = private_key + public_key
@@ -1,6 +1,5 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gem "rails", "~> 3.2.10"
4
- gem "strongbox", :path=>"../"
5
4
 
6
- gemspec :path=>"../"
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 4.2.8"
4
+
5
+ gemspec :path => "../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 5.1.4"
4
+
5
+ gemspec :path => "../"
@@ -1,11 +1,12 @@
1
1
  require 'openssl'
2
2
  require 'base64'
3
3
 
4
+ require 'strongbox/cipher'
4
5
  require 'strongbox/lock'
5
6
 
6
7
  module Strongbox
7
8
 
8
- VERSION = "0.7.2"
9
+ VERSION = "0.7.3"
9
10
 
10
11
  RSA_PKCS1_PADDING = OpenSSL::PKey::RSA::PKCS1_PADDING
11
12
  RSA_SSLV23_PADDING = OpenSSL::PKey::RSA::SSLV23_PADDING
@@ -0,0 +1,7 @@
1
+ module Strongbox
2
+ if RUBY_VERSION >= '2.4.0'
3
+ class Cipher < OpenSSL::Cipher; end
4
+ else
5
+ class Cipher < OpenSSL::Cipher::Cipher; end
6
+ end
7
+ end
@@ -48,7 +48,7 @@ module Strongbox
48
48
  # the private key if the file is a key pair
49
49
  public_key = get_rsa_key(@public_key,"")
50
50
  if @symmetric == :always
51
- cipher = OpenSSL::Cipher::Cipher.new(@symmetric_cipher)
51
+ cipher = Cipher.new(@symmetric_cipher)
52
52
  cipher.encrypt
53
53
  cipher.key = random_key = cipher.random_key
54
54
  cipher.iv = random_iv = cipher.random_iv
@@ -100,7 +100,7 @@ module Strongbox
100
100
  random_key = Base64.decode64(random_key)
101
101
  random_iv = Base64.decode64(random_iv)
102
102
  end
103
- cipher = OpenSSL::Cipher::Cipher.new(@symmetric_cipher)
103
+ cipher = Cipher.new(@symmetric_cipher)
104
104
  cipher.decrypt
105
105
  cipher.key = private_key.private_decrypt(random_key,@padding)
106
106
  cipher.iv = private_key.private_decrypt(random_iv,@padding)
@@ -124,11 +124,11 @@ module Strongbox
124
124
 
125
125
  # Needed for validations
126
126
  def blank?
127
- @raw_content.blank? and @instance[@name].blank?
127
+ @raw_content.blank? && @instance[@name].blank?
128
128
  end
129
129
 
130
130
  def nil?
131
- @raw_content.nil? and @instance[@name].nil?
131
+ @raw_content.nil? && @instance[@name].nil?
132
132
  end
133
133
 
134
134
  def size
@@ -39,7 +39,7 @@ class MethodKeyTest < Test::Unit::TestCase
39
39
  setup do
40
40
  @password = 'boost facile'
41
41
  rsa_key = OpenSSL::PKey::RSA.new(2048)
42
- cipher = OpenSSL::Cipher::Cipher.new('des3')
42
+ cipher = Strongbox::Cipher.new('des3')
43
43
  rebuild_model :public_key => :public_key_attribute,
44
44
  :private_key => :private_key_attribute
45
45
  Dummy.class_eval do
@@ -59,8 +59,12 @@ class MissingAttribuesTest < Test::Unit::TestCase
59
59
  end
60
60
 
61
61
  should 'not raise' do
62
- assert_nothing_raised do
62
+ assert_nothing_raised Strongbox::StrongboxError do
63
63
  Dummy.class_eval do
64
+ def []=(_attr_name, _value)
65
+ # Stub to prevent ActiveModel::MissingAttributeError error
66
+ end
67
+
64
68
  encrypt_with_public_key(:secret,
65
69
  :key_pair => File.join(FIXTURES_DIR,'keypair.pem'),
66
70
  :ensure_required_columns => false)
@@ -65,7 +65,7 @@ def generate_key_pair(password = nil,size = 2048)
65
65
  rsa_key = OpenSSL::PKey::RSA.new(size)
66
66
  # If no password is provided, don't encrypt the key
67
67
  return rsa_key if password.blank?
68
- cipher = OpenSSL::Cipher::Cipher.new('des3')
68
+ cipher = Strongbox::Cipher.new('des3')
69
69
  key_pair = rsa_key.to_pem(cipher,password)
70
70
  key_pair << rsa_key.public_key.to_pem
71
71
  return key_pair
metadata CHANGED
@@ -1,121 +1,124 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spike Ilacqua
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-01 00:00:00.000000000 Z
11
+ date: 2017-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thoughtbot-shoulda
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.9.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.3.7
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.3.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 10.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 10.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdoc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 2.4.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 2.4.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: test-unit
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.0.9
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.0.9
97
- description: ! " Strongbox provides Public Key Encryption for ActiveRecord. By
98
- using a\n public key sensitive information can be encrypted and stored automatically.\n
99
- \ Once stored a password is required to access the information. dependencies\n
100
- \ are specified in standard Ruby syntax.\n"
97
+ description: |2
98
+ Strongbox provides Public Key Encryption for ActiveRecord. By using a
99
+ public key sensitive information can be encrypted and stored automatically.
100
+ Once stored a password is required to access the information. dependencies
101
+ are specified in standard Ruby syntax.
101
102
  email: spike@stuff-things.net
102
103
  executables: []
103
104
  extensions: []
104
105
  extra_rdoc_files: []
105
106
  files:
106
- - .gitignore
107
- - .travis.yml
107
+ - ".gitignore"
108
+ - ".ruby-version"
109
+ - ".travis.yml"
110
+ - CHANGELOG.md
108
111
  - Gemfile
109
112
  - LICENSE
110
113
  - README.md
111
114
  - Rakefile
112
115
  - gemfiles/.gitignore
113
- - gemfiles/2.3.gemfile
114
- - gemfiles/3.0.gemfile
115
- - gemfiles/3.1.gemfile
116
116
  - gemfiles/3.2.gemfile
117
+ - gemfiles/4.2.gemfile
118
+ - gemfiles/5.1.gemfile
117
119
  - init.rb
118
120
  - lib/strongbox.rb
121
+ - lib/strongbox/cipher.rb
119
122
  - lib/strongbox/lock.rb
120
123
  - rails/init.rb
121
124
  - strongbox.gemspec
@@ -138,17 +141,17 @@ require_paths:
138
141
  - lib
139
142
  required_ruby_version: !ruby/object:Gem::Requirement
140
143
  requirements:
141
- - - ! '>='
144
+ - - ">="
142
145
  - !ruby/object:Gem::Version
143
146
  version: '0'
144
147
  required_rubygems_version: !ruby/object:Gem::Requirement
145
148
  requirements:
146
- - - ! '>='
149
+ - - ">="
147
150
  - !ruby/object:Gem::Version
148
151
  version: '0'
149
152
  requirements: []
150
153
  rubyforge_project:
151
- rubygems_version: 2.4.5
154
+ rubygems_version: 2.6.11
152
155
  signing_key:
153
156
  specification_version: 4
154
157
  summary: Secures ActiveRecord fields with public key encryption.
@@ -1,6 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "rails", "~> 2.3.15"
4
- gem "strongbox", :path=>"../"
5
-
6
- gemspec :path=>"../"
@@ -1,6 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "rails", "~> 3.0.19"
4
- gem "strongbox", :path=>"../"
5
-
6
- gemspec :path=>"../"
@@ -1,6 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "rails", "~> 3.1.10"
4
- gem "strongbox", :path=>"../"
5
-
6
- gemspec :path=>"../"