vidibus-secure 0.3.2 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +0 -0
- data/README.md +9 -6
- data/Rakefile +0 -0
- data/lib/generators/vidibus_secure_key/vidibus_secure_key_generator.rb +4 -8
- data/lib/vidibus/secure/extensions/controller.rb +0 -0
- data/lib/vidibus/secure/extensions.rb +0 -0
- data/lib/vidibus/secure/mongoid.rb +5 -3
- data/lib/vidibus/secure/version.rb +1 -1
- data/lib/vidibus/secure.rb +1 -1
- data/lib/vidibus-secure.rb +0 -0
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c6e19394e65e0b26b4b984609723d708e93cbfcc0d8e26c4b8f9b3c14ba168b3
|
4
|
+
data.tar.gz: 55981c68d9fc1269a0302e40ec47f6b95c48243665b9d0035b846607af877b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 328a4d934659747d50ff53ddb1e77fe462e9168daa05d0ed92aa899867656aee326a02383ac1ed4e098d8fc1d40c48e698cba0d61434297c7279a7563a775147
|
7
|
+
data.tar.gz: a7c90ccf4e6c508deda61a89a88ce5a3303ba55a1c3e9120f2a99a7d12305b325fa80474bf6bd1a00ebf17647ef47c3772f3677ed956bd48be1ae24b41ebca2c
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Vidibus::Secure
|
1
|
+
# Vidibus::Secure
|
2
2
|
|
3
3
|
Allows encryption and signing of requests and storing encrypted data within Mongoid documents.
|
4
4
|
|
@@ -14,14 +14,17 @@ If you want to use Vidibus::Secure::Mongoid on your models, you should generate
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
|
17
|
+
```
|
18
|
+
class MyModel
|
19
|
+
include Mongoid::Document
|
20
|
+
include Vidibus::Secure::Mongoid
|
18
21
|
|
22
|
+
attr_encrypted :my_secret
|
23
|
+
```
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
* Documentation
|
25
|
+
Defining `attr_encrypted :my_secret` will create setter and getter for `my_secret`. You can use it like normal. But it will be stored encrypted.
|
23
26
|
|
24
27
|
|
25
28
|
## Copyright
|
26
29
|
|
27
|
-
© 2010-
|
30
|
+
© 2010-2023 Andre Pankratz. See LICENSE for details.
|
data/Rakefile
CHANGED
File without changes
|
@@ -1,11 +1,7 @@
|
|
1
1
|
class VidibusSecureKeyGenerator < Rails::Generators::Base
|
2
|
-
desc '
|
2
|
+
desc 'Creates secure key to be stored as ENV["VIDIBUS_SECURE_KEY"]'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
%(# Do not change this encryption key! Otherwise you will not be able to decrypt data already stored in your database.\n) +
|
8
|
-
%(ENV["VIDIBUS_SECURE_KEY"] = "#{Vidibus::Secure.random(:encoding => :base64, :length => 100)}")
|
9
|
-
end
|
10
|
-
end
|
4
|
+
puts "\nAdd VIDIBUS_SECURE_KEY to your env file like ~/.bashrc, /etc/profile or ~/.zprofile"
|
5
|
+
key = %(export VIDIBUS_SECURE_KEY=#{Vidibus::Secure.random(:encoding => :base64, :length => 100)})
|
6
|
+
puts key
|
11
7
|
end
|
File without changes
|
File without changes
|
@@ -12,19 +12,21 @@ module Vidibus
|
|
12
12
|
|
13
13
|
# Define Mongoid field
|
14
14
|
encrypted_field = "#{field}_encrypted"
|
15
|
-
self.send(:field, encrypted_field, :
|
15
|
+
self.send(:field, encrypted_field, type: BSON::Binary)
|
16
16
|
|
17
17
|
# Define setter
|
18
18
|
class_eval <<-EOV
|
19
19
|
def #{field}=(value)
|
20
|
-
self.#{encrypted_field} = value ?
|
20
|
+
self.#{encrypted_field} = value ?
|
21
|
+
Vidibus::Secure.encrypt(value, "#{key}") :
|
22
|
+
nil
|
21
23
|
end
|
22
24
|
EOV
|
23
25
|
|
24
26
|
# Define getter
|
25
27
|
class_eval <<-EOV
|
26
28
|
def #{field}
|
27
|
-
Vidibus::Secure.decrypt(#{encrypted_field}, "#{key}") if #{encrypted_field}
|
29
|
+
Vidibus::Secure.decrypt(#{encrypted_field}.data, "#{key}") if #{encrypted_field}
|
28
30
|
end
|
29
31
|
EOV
|
30
32
|
end
|
data/lib/vidibus/secure.rb
CHANGED
@@ -114,7 +114,7 @@ module Vidibus
|
|
114
114
|
|
115
115
|
def crypt(cipher_method, data, key, options = {})
|
116
116
|
return unless data && data != ''
|
117
|
-
cipher = OpenSSL::Cipher
|
117
|
+
cipher = OpenSSL::Cipher.new(options[:algorithm])
|
118
118
|
digest = OpenSSL::Digest::SHA512.new(key).digest
|
119
119
|
cipher.send(cipher_method)
|
120
120
|
cipher.pkcs5_keyivgen(digest)
|
data/lib/vidibus-secure.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-secure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andre Pankratz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 8.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 8.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name: database_cleaner
|
182
|
+
name: database_cleaner-mongoid
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
@@ -213,7 +213,7 @@ homepage: https://github.com/vidibus/vidibus-secure
|
|
213
213
|
licenses:
|
214
214
|
- MIT
|
215
215
|
metadata: {}
|
216
|
-
post_install_message:
|
216
|
+
post_install_message:
|
217
217
|
rdoc_options: []
|
218
218
|
require_paths:
|
219
219
|
- lib
|
@@ -228,9 +228,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: 1.3.6
|
230
230
|
requirements: []
|
231
|
-
|
232
|
-
|
233
|
-
signing_key:
|
231
|
+
rubygems_version: 3.0.9
|
232
|
+
signing_key:
|
234
233
|
specification_version: 4
|
235
234
|
summary: Security tools for Vidibus applications
|
236
235
|
test_files: []
|