blufin-lib 1.5.8 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blufin-lib.rb +0 -1
- data/lib/version.rb +1 -1
- metadata +1 -16
- data/lib/core/encryptor.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47d99322f3755791c06effe26717be00690b39b0
|
4
|
+
data.tar.gz: ea8f45b83c0def7502c9d2f981e6cdbc823589a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f89d1ab0474a7985d406cd4c57c08246d38e733f6c6794beeff0d58ea0a87a4375d2c8f52e638b8e974689a93f80c0ed99f8f8e89088a0dbb69ef62b60c0f5
|
7
|
+
data.tar.gz: 478b0a26f32c31fbca953987569f65d196ca7d5e22ba5efdc1b1cef2ea7973b0154ab923812e98d4fe8d9456433795c2a71147a0842688063d233073a34f39c4
|
data/lib/blufin-lib.rb
CHANGED
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
BLUFIN_LIB_VERSION = '1.
|
1
|
+
BLUFIN_LIB_VERSION = '1.6.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blufin-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Rannetsperger
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 4.9.3
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: openssl
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 2.0.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 2.0.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: parseconfig
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +133,6 @@ files:
|
|
147
133
|
- lib/core/base.rb
|
148
134
|
- lib/core/config.rb
|
149
135
|
- lib/core/datetime_utils.rb
|
150
|
-
- lib/core/encryptor.rb
|
151
136
|
- lib/core/files.rb
|
152
137
|
- lib/core/image.rb
|
153
138
|
- lib/core/network.rb
|
data/lib/core/encryptor.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
require 'base64'
|
3
|
-
|
4
|
-
module Blufin
|
5
|
-
|
6
|
-
class Encryptor
|
7
|
-
|
8
|
-
def initialize(key = nil, hex = nil)
|
9
|
-
|
10
|
-
@key = key
|
11
|
-
@hex = hex
|
12
|
-
|
13
|
-
raise RuntimeError, "Encryptor hasn't been properly initialized. You forgot to pass the CRYPT_KEY + CRYPT_HEX to the constructor when instantiating the class." if @key.nil? || @hex.nil?
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
def encrypt(string)
|
18
|
-
|
19
|
-
c = OpenSSL::Cipher.new('aes-256-cbc')
|
20
|
-
c.encrypt
|
21
|
-
c.key = Digest::SHA1.hexdigest(@hex)[0..31]
|
22
|
-
begin
|
23
|
-
d = c.update(string)
|
24
|
-
d << c.final
|
25
|
-
return Base64.encode64(d)
|
26
|
-
rescue => e
|
27
|
-
Blufin::Terminal::error('Encryption failed', "Could not encrypt string \xe2\x86\x92 #{string == '' ? '[blank]' : Blufin::Terminal::format_invalid(string)}", false)
|
28
|
-
Blufin::Terminal::print_exception(e)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def decrypt(string)
|
34
|
-
|
35
|
-
string_decoded = Base64.decode64(string)
|
36
|
-
c = OpenSSL::Cipher.new('aes-256-cbc')
|
37
|
-
c.decrypt
|
38
|
-
c.key = Digest::SHA1.hexdigest(@hex)[0..31]
|
39
|
-
begin
|
40
|
-
d = c.update(string_decoded)
|
41
|
-
d << c.final
|
42
|
-
return d
|
43
|
-
rescue => e
|
44
|
-
Blufin::Terminal::error('Decryption failed', "Could not decrypt string \xe2\x86\x92 #{string == '' ? '[blank]' : Blufin::Terminal::format_invalid(string)}", false)
|
45
|
-
Blufin::Terminal::print_exception(e)
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|