go_secure 0.65 → 0.66
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/go_secure.rb +10 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b937e6fe86f92dcaa9c2dde3089ded9e180460f2290b9d9cc33f4903f88b5504
|
4
|
+
data.tar.gz: b453f17db5585ffdc849692f1e16179d53c1d6771258f2a669108763852555d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ec28b36c2a980721633a409fe65cff6287a2e9f535738fb5aefc90cd280b8fdd02e201931c8da771d5824a878dfc9c0f8acccb5df863a826254aaf5be0ada91
|
7
|
+
data.tar.gz: a1d0ec1bcdb45d101b17804f609a03483418fff919b5f4bd3892d54197918274b8233f4e364dbc2c958a4f790aef27205c6c8f7255f90220bdaaaebe0f62f6a8
|
data/lib/go_secure.rb
CHANGED
@@ -20,9 +20,10 @@ module GoSecure
|
|
20
20
|
|
21
21
|
def self.encrypt(str, ref, encryption_key=nil)
|
22
22
|
require 'base64'
|
23
|
-
c = OpenSSL::Cipher
|
23
|
+
c = OpenSSL::Cipher.new('aes-256-cbc')
|
24
24
|
c.encrypt
|
25
|
-
|
25
|
+
sha = Digest::SHA2.hexdigest(ref + "_" + (encryption_key || self.encryption_key))
|
26
|
+
c.key = sha[0..31]
|
26
27
|
c.iv = iv = c.random_iv
|
27
28
|
e = c.update(str)
|
28
29
|
e << c.final
|
@@ -32,10 +33,13 @@ module GoSecure
|
|
32
33
|
|
33
34
|
def self.decrypt(str, salt, ref, encryption_key=nil)
|
34
35
|
require 'base64'
|
35
|
-
c = OpenSSL::Cipher
|
36
|
+
c = OpenSSL::Cipher.new('aes-256-cbc')
|
36
37
|
c.decrypt
|
37
|
-
|
38
|
-
c.
|
38
|
+
sha = Digest::SHA2.hexdigest(ref + "_" + (encryption_key || self.encryption_key))
|
39
|
+
c.key = sha[0..31]
|
40
|
+
iv = Base64.decode64(salt)
|
41
|
+
|
42
|
+
c.iv = iv[0..15]
|
39
43
|
d = c.update(Base64.decode64(str))
|
40
44
|
d << c.final
|
41
45
|
d.to_s
|
@@ -47,7 +51,7 @@ module GoSecure
|
|
47
51
|
# pw['hash_type'] = 'sha512'
|
48
52
|
# pw['hash_type'] = 'bcrypt'
|
49
53
|
pw['hash_type'] = 'pbkdf2-sha256-2'
|
50
|
-
pw['salt'] = Digest::MD5.hexdigest(OpenSSL::Random.
|
54
|
+
pw['salt'] = Digest::MD5.hexdigest(OpenSSL::Random.random_bytes(4) + Time.now.to_i.to_s + self.encryption_key + "pw" + OpenSSL::Random.random_bytes(16))
|
51
55
|
# pw['hashed_password'] = Digest::SHA512.hexdigest(self.encryption_key + pw['salt'] + password.to_s)
|
52
56
|
# salted = Digest::SHA256.hexdigest(self.encryption_key + pw['salt'] + password.to_s)
|
53
57
|
# pw['hashed_password'] = BCrypt::Password.create(salted)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: go_secure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.66'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Whitmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.7.6
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Go Secure
|