opensecret 0.0.913 → 0.0.941

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -0
  3. data/README.md +129 -19
  4. data/Rakefile +0 -9
  5. data/bin/opensecret +1 -1
  6. data/lib/{opensecret/plugins.io/cipher/crypto.rb → crypto/amalgam.rb} +6 -8
  7. data/lib/crypto/collect.rb +139 -0
  8. data/lib/crypto/engineer.rb +201 -0
  9. data/lib/crypto/verify.rb +33 -0
  10. data/lib/extension/array.rb +133 -0
  11. data/lib/{opensecret/additions → extension}/dir.rb +0 -0
  12. data/lib/extension/file.rb +56 -0
  13. data/lib/extension/hash.rb +33 -0
  14. data/lib/extension/string.rb +349 -0
  15. data/lib/factbase/facts.opensecret.io.ini +28 -0
  16. data/lib/logging/gem.logging.rb +133 -0
  17. data/lib/opensecret.rb +102 -45
  18. data/lib/opensecret/executors/crypt.keys/crypt.keys.ini +0 -53
  19. data/lib/session/{session.rb → attributes.rb} +60 -5
  20. data/lib/session/exceptions.rb +53 -0
  21. data/lib/session/fact.finder.rb +684 -0
  22. data/lib/session/user.home.rb +49 -0
  23. data/lib/usecase/usecase.rb +245 -0
  24. data/lib/usecase/usecases/init.rb +190 -0
  25. data/lib/usecase/usecases/on.rb +33 -0
  26. data/lib/usecase/usecases/safe.rb +95 -0
  27. data/lib/version.rb +1 -1
  28. metadata +22 -17
  29. data/lib/opensecret/additions/array.rb +0 -117
  30. data/lib/opensecret/additions/string.rb +0 -312
  31. data/lib/opensecret/commons/eco.cmdline.rb +0 -446
  32. data/lib/opensecret/eco.do.rb +0 -46
  33. data/lib/opensecret/plugins.io/error/eco.exceptions.rb +0 -24
  34. data/lib/opensecret/plugins.io/facts/fact.chars.rb +0 -66
  35. data/lib/opensecret/plugins.io/facts/fact.factor.rb +0 -156
  36. data/lib/opensecret/plugins.io/facts/fact.locator.rb +0 -105
  37. data/lib/opensecret/plugins.io/facts/fact.reader.rb +0 -137
  38. data/lib/opensecret/plugins.io/facts/fact.tree.rb +0 -661
  39. data/lib/opensecret/plugins.io/logs/log.object.rb +0 -89
  40. data/lib/opensecret/plugins.io/logs/logging.rb +0 -203
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/ruby
2
+
3
+ module OpenSecret
4
+
5
+ # This is the [On] usecase that is triggered when a user would like
6
+ # to start a locking (encryption) session.
7
+ #
8
+ # Pre-Conditions
9
+ #
10
+ # - [session.config.file] exists with domain,user,email,store_id => store_url
11
+ # -
12
+ # -
13
+ #
14
+ #
15
+ # Main Flow of Events
16
+ #
17
+ # -
18
+ # -
19
+ #
20
+ class On < OpenSession::UseCase
21
+
22
+
23
+ def execute
24
+
25
+
26
+ end
27
+
28
+
29
+ end
30
+
31
+
32
+ end
33
+
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/ruby
2
+
3
+ module OpenSecret
4
+
5
+ require "usecase/usecase"
6
+ require "session/attributes"
7
+
8
+ # This is the [On] usecase that is triggered when a user would like
9
+ # to start a locking (encryption) session.
10
+ #
11
+ # Pre-Conditions
12
+ #
13
+ # - [session.config.file] exists with domain,user,email,store_id => store_url
14
+ # -
15
+ # -
16
+ #
17
+ #
18
+ # Main Flow of Events
19
+ #
20
+ # -
21
+ # -
22
+ #
23
+ class Safe < OpenSession::UseCase
24
+
25
+ attr_writer :safe_path
26
+ @@context_name = "opensecret"
27
+ @@prime_name = "opensecret.safe"
28
+
29
+
30
+ def execute
31
+
32
+
33
+ OpenSession::Attributes.stash @@context_name, "safe", @safe_path
34
+ FileUtils.mkdir_p @safe_path unless File.exists? @safe_path
35
+
36
+ end
37
+
38
+
39
+ def pre_validation
40
+
41
+ needs_chopping = @safe_path.end_with?("/") || @safe_path.end_with?("\\")
42
+ @safe_path = @safe_path.chop if needs_chopping
43
+
44
+ index_1st = @safe_path.index @@prime_name
45
+ index_2nd = @safe_path.rindex @@prime_name
46
+
47
+ xtra_msg = "Text [ #{@@prime_name} ] can only appear once in [ #{@safe_path} ]."
48
+ raise SafePrimeNameRepeated.new xtra_msg, @safe_path unless index_1st == index_2nd
49
+
50
+ unless @safe_path.end_with? @@prime_name
51
+
52
+ if @safe_path.include? @@prime_name
53
+ prime_name_end_index = @safe_path.index(@@prime_name) + @@prime_name.length
54
+ @safe_path = @safe_path[0..prime_name_end_index]
55
+ else
56
+ @safe_path = File.join @safe_path, @@prime_name
57
+ end
58
+
59
+ ends_with_prime = @safe_path.end_with? @@prime_name
60
+ not_at_end_msg = "Text [#{@@prime_name} ] is not at end of [ #{@safe_path} ]."
61
+ raise SafePrimeNameNotAtEnd.new not_at_end_msg, @safe_path unless ends_with_prime
62
+
63
+ end
64
+
65
+ if( File.exists?( @safe_path ) && !(File.directory? @safe_path) )
66
+ raise SafeDirectoryIsFile.new "the [safe] directory path points to a file", @safe_path
67
+ end
68
+
69
+ end
70
+
71
+
72
+ # The safe_path instance attribute must be configured within
73
+ # the context configuration file using a keyname of "safe".
74
+ #
75
+ # @raise ArgumentError for any one of a long list of reasons that
76
+ # cause the key value to not be retrieved. This can range from
77
+ # non-existent directories and files, non readable files, incorrect
78
+ # configurations right down to missing keys or even missing values.
79
+ def post_validation
80
+
81
+ configured_path = OpenSession::Attributes.instance.get_value @@context_name, "safe"
82
+ path_string_1 = " path 1 => #{configured_path}"
83
+ path_string_2 = " path 2 => #{@safe_path}"
84
+ mismatch_path = "Path mismatch to opensecret [safe] detected."
85
+ err_msg = "\n" + mismatch_path + "\n" + path_string_1 + "\n" + path_string_2 + "\n"
86
+
87
+ raise RuntimeError, err_msg unless @safe_path.eql? configured_path
88
+
89
+
90
+ end
91
+
92
+ end
93
+
94
+
95
+ end
@@ -1,3 +1,3 @@
1
1
  module OpenSecret
2
- VERSION = "0.0.913"
2
+ VERSION = "0.0.941"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensecret
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.913
4
+ version: 0.0.941
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apollo Akora
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-11 00:00:00.000000000 Z
11
+ date: 2018-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
@@ -93,6 +93,7 @@ extra_rdoc_files: []
93
93
  files:
94
94
  - ".gitignore"
95
95
  - ".travis.yml"
96
+ - ".yardopts"
96
97
  - CODE_OF_CONDUCT.md
97
98
  - Gemfile
98
99
  - LICENSE.txt
@@ -100,15 +101,21 @@ files:
100
101
  - Rakefile
101
102
  - bin/opensecret
102
103
  - lib/config.opensecret.ini
104
+ - lib/crypto/amalgam.rb
105
+ - lib/crypto/collect.rb
106
+ - lib/crypto/engineer.rb
107
+ - lib/crypto/verify.rb
108
+ - lib/extension/array.rb
109
+ - lib/extension/dir.rb
110
+ - lib/extension/file.rb
111
+ - lib/extension/hash.rb
112
+ - lib/extension/string.rb
113
+ - lib/factbase/facts.opensecret.io.ini
114
+ - lib/logging/gem.logging.rb
103
115
  - lib/opensecret.rb
104
- - lib/opensecret/additions/array.rb
105
- - lib/opensecret/additions/dir.rb
106
- - lib/opensecret/additions/string.rb
107
- - lib/opensecret/commons/eco.cmdline.rb
108
116
  - lib/opensecret/commons/eco.faculty.rb
109
117
  - lib/opensecret/commons/eco.system.rb
110
118
  - lib/opensecret/commons/eco.systems.rb
111
- - lib/opensecret/eco.do.rb
112
119
  - lib/opensecret/executors/crypt.keys/crypt.keys.ini
113
120
  - lib/opensecret/executors/crypt.keys/crypt.keys.rb
114
121
  - lib/opensecret/executors/decrypt/decrypt.ini
@@ -123,19 +130,17 @@ files:
123
130
  - lib/opensecret/factbase/readme.md
124
131
  - lib/opensecret/factbase/retired.facts/maven.database.ide.facts.ini
125
132
  - lib/opensecret/factbase/retired.facts/s3-upload-block-facts.ini
126
- - lib/opensecret/plugins.io/cipher/crypto.rb
127
- - lib/opensecret/plugins.io/error/eco.exceptions.rb
128
- - lib/opensecret/plugins.io/facts/fact.chars.rb
129
- - lib/opensecret/plugins.io/facts/fact.factor.rb
130
- - lib/opensecret/plugins.io/facts/fact.locator.rb
131
- - lib/opensecret/plugins.io/facts/fact.reader.rb
132
- - lib/opensecret/plugins.io/facts/fact.tree.rb
133
133
  - lib/opensecret/plugins.io/file/file.rb
134
134
  - lib/opensecret/plugins.io/git/git.flow.rb
135
- - lib/opensecret/plugins.io/logs/log.object.rb
136
- - lib/opensecret/plugins.io/logs/logging.rb
137
- - lib/session/session.rb
135
+ - lib/session/attributes.rb
136
+ - lib/session/exceptions.rb
137
+ - lib/session/fact.finder.rb
138
138
  - lib/session/time.stamp.rb
139
+ - lib/session/user.home.rb
140
+ - lib/usecase/usecase.rb
141
+ - lib/usecase/usecases/init.rb
142
+ - lib/usecase/usecases/on.rb
143
+ - lib/usecase/usecases/safe.rb
139
144
  - lib/version.rb
140
145
  - opensecret.gemspec
141
146
  homepage: https://www.eco-platform.co.uk
@@ -1,117 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- # --
4
- # -- Reopen the core ruby Array class and add the below methods to it.
5
- # --
6
- # -- Case Sensitivity rules for [ALL] the below methods that are
7
- # -- added to the core Ruby string class.
8
- # --
9
- # -- For case insensitive behaviour make sure you downcase both the
10
- # -- string object and the parameter strings (or strings within
11
- # -- other parameter objects, like arrays and hashes).
12
- # --
13
- class Array
14
-
15
- # --
16
- # -- Get the text [in between] this and that delimeter [exclusively].
17
- # -- Exclusively means the returned text [does not] include either of
18
- # -- the matched delimeters (although an unmatched instance of [this]
19
- # -- delimeter may appear in the in-between text).
20
- # --
21
- # -- --------------------
22
- # -- Multiple Delimiters
23
- # -- --------------------
24
- # --
25
- # -- When multiple delimiters exist, the text returned is in between the
26
- # --
27
- # -- [a] - first occurrence of [this] delimeter AND the
28
- # -- [b] - 1st occurrence of [that] delimeter [AFTER] the 1st delimiter
29
- # --
30
- # -- Instances of [that] delimiter occurring before [this] are ignored.
31
- # -- The text could contain [this] delimeter instances but is guaranteed
32
- # -- not to contain a [that] delimeter.
33
- # --
34
- # -- -----------
35
- # -- Parameters
36
- # -- -----------
37
- # --
38
- # -- this_delimiter : begin delimeter (not included in returned string)
39
- # -- that_delimiter : end delimeter (not included in returned string)
40
- # --
41
- # -- -----------
42
- # -- Exceptions
43
- # -- -----------
44
- # --
45
- # -- An exception (error) will be thrown if
46
- # --
47
- # -- => any nil (or empties) exist in the input parameters
48
- # -- => [this] delimeter does not appear in the in_string
49
- # -- => [that] delimeter does not appear after [this] one
50
- # --
51
- def before_and_after begin_delimeter, end_delimeter
52
-
53
- Throw.if_nil_or_empty_strings [ self, begin_delimeter, end_delimeter ]
54
-
55
- before_after_lines = []
56
- in_middle_bit = false
57
-
58
- self.each do |candidate_line|
59
-
60
- is_middle_boundary = !in_middle_bit && candidate_line.downcase.include?(begin_delimeter.downcase)
61
- if is_middle_boundary
62
- in_middle_bit = true
63
- next
64
- end
65
-
66
- unless in_middle_bit
67
- before_after_lines.push candidate_line
68
- next
69
- end
70
-
71
- #--
72
- #-- Now we are definitely in the middle bit.
73
- #-- Let's check for the middle end delimeter
74
- #--
75
- if candidate_line.downcase.include? end_delimeter.downcase
76
- in_middle_bit = false
77
- end
78
-
79
- end
80
-
81
- return before_after_lines
82
-
83
- end
84
-
85
-
86
- def middlle_bit begin_delimeter, end_delimeter
87
-
88
- Throw.if_nil_or_empty_strings [ self, begin_delimeter, end_delimeter ]
89
-
90
- middle_lines = []
91
- in_middle_bit = false
92
-
93
- self.each do |candidate_line|
94
-
95
- is_middle_boundary = !in_middle_bit && candidate_line.downcase.include?(begin_delimeter.downcase)
96
- if is_middle_boundary
97
- in_middle_bit = true
98
- next
99
- end
100
-
101
- end_of_middle = in_middle_bit && candidate_line.downcase.include?(end_delimeter.downcase)
102
- return middle_lines if end_of_middle
103
-
104
- #--
105
- #-- We are definitely in the middle bit.
106
- #--
107
- middle_lines.push(candidate_line) if in_middle_bit
108
-
109
- end
110
-
111
- unreachable_str = "This point should be unreachable unless facts are ended."
112
- raise RuntimeError.new unreachable_str
113
-
114
- end
115
-
116
-
117
- end
@@ -1,312 +0,0 @@
1
- #!/usr/bin/ruby
2
-
3
- # --
4
- # -- Reopen the core ruby String class and add the below methods to it.
5
- # --
6
- # -- Case Sensitivity rules for [ALL] the below methods that are
7
- # -- added to the core Ruby string class.
8
- # --
9
- # -- For case insensitive behaviour make sure you downcase both the
10
- # -- string object and the parameter strings (or strings within
11
- # -- other parameter objects, like arrays and hashes).
12
- # --
13
- class String
14
-
15
- # --
16
- # -- Get the text [in between] this and that delimeter [exclusively].
17
- # -- Exclusively means the returned text [does not] include either of
18
- # -- the matched delimeters (although an unmatched instance of [this]
19
- # -- delimeter may appear in the in-between text).
20
- # --
21
- # -- --------------------
22
- # -- Multiple Delimiters
23
- # -- --------------------
24
- # --
25
- # -- When multiple delimiters exist, the text returned is in between the
26
- # --
27
- # -- [a] - first occurrence of [this] delimeter AND the
28
- # -- [b] - 1st occurrence of [that] delimeter [AFTER] the 1st delimiter
29
- # --
30
- # -- Instances of [that] delimiter occurring before [this] are ignored.
31
- # -- The text could contain [this] delimeter instances but is guaranteed
32
- # -- not to contain a [that] delimeter.
33
- # --
34
- # -- -----------
35
- # -- Parameters
36
- # -- -----------
37
- # --
38
- # -- this_delimiter : begin delimeter (not included in returned string)
39
- # -- that_delimiter : end delimeter (not included in returned string)
40
- # --
41
- # -- -----------
42
- # -- Exceptions
43
- # -- -----------
44
- # --
45
- # -- An exception (error) will be thrown if
46
- # --
47
- # -- => any nil (or empties) exist in the input parameters
48
- # -- => [this] delimeter does not appear in the in_string
49
- # -- => [that] delimeter does not appear after [this] one
50
- # --
51
- def in_between this_delimeter, that_delimeter
52
-
53
- Throw.if_nil_or_empty_strings [ self, this_delimeter, that_delimeter ]
54
-
55
- scanner_1 = StringScanner.new self
56
- scanner_1.scan_until /#{this_delimeter}/
57
- scanner_2 = StringScanner.new scanner_1.post_match
58
- scanner_2.scan_until /#{that_delimeter}/
59
-
60
- in_between_text = scanner_2.pre_match.strip
61
- log.info(ere){ in_between_text }
62
-
63
- return in_between_text
64
-
65
- # --> file_text = File.read "c:/Users/apollo13/mirror.techwiki/documents/collaboration-tech/gollum/gollum-certbot-ssl.md"
66
-
67
- # --> this_delimeter = "<!-- facts"
68
- # --> that_delimeter = "-->"
69
-
70
- # --> scanner = StringScanner.new file_text
71
- # --> log.info(ere){ "1st Delimiter => #{this_delimeter}" }
72
- # --> log.info(ere){ "2nd Delimiter => #{that_delimeter}" }
73
- # --> before_text = scanner.scan_until /#{this_delimeter}/
74
- # --> post_match_text = scanner.post_match
75
- # --> scanner2 = StringScanner.new post_match_text
76
- # --> scanner2.scan_until /#{that_delimeter}/
77
- # --> best_text = scanner2.pre_match.strip
78
-
79
- # --> best_text = Strings.in_between file_text, this_delimeter, that_delimeter
80
-
81
- # --> log.info(ere){ "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" }
82
- # --> log.info(ere){ "What We Want" }
83
- # --> log.info(ere){ "======================================================" }
84
- # --> log.info(ere){ best_text }
85
- # --> log.info(ere){ "======================================================" }
86
-
87
- # --> exit
88
-
89
- end
90
-
91
-
92
- # --
93
- # -- Return true if the [little string] within this
94
- # -- string object is both
95
- # --
96
- # -- a] topped by the parameter prefix AND
97
- # -- b] tailed by the parameter postfix
98
- # --
99
- # -- -----------------------------------------
100
- # -- In the below example [true] is returned
101
- # -- -----------------------------------------
102
- # --
103
- # -- This [String] => "Hey [<-secrets->] are juicy."
104
- # -- little string => "secrets"
105
- # -- topped string => "[<-"
106
- # -- tailed string => "->]"
107
- # --
108
- # -- Why true? Because the little string "secret" is
109
- # -- (wrapped) topped by "[<-" and tailed by "->]"
110
- # --
111
- # -- -----------------------------------------
112
- # -- Assumptions | Constraints | Boundaries
113
- # -- -----------------------------------------
114
- # --
115
- # -- - all matches are [case sensitive]
116
- # -- - this string must contain little_str
117
- # -- - one strike and its true
118
- # -- (if little string appears more than once)
119
- # -- so => "all secrets, most [<-secrets->] r juicy"
120
- # -- => true as long as (at least) one is wrapped
121
- # --
122
- # --
123
- def has_wrapped? little_str, prefix, postfix
124
-
125
- return self.include?( prefix + little_str + postfix )
126
-
127
- end
128
-
129
-
130
- # --
131
- # -- Sandwich the first occurrence of a substring in
132
- # -- this string with the specified pre and postfix.
133
- # --
134
- # -- This string contains the little string and an
135
- # -- IN-PLACE change is performed with the first
136
- # -- occurrence of the little string being prefixed
137
- # -- and postfixed with the 2 parameter strings.
138
- # --
139
- # -- ----------------------------------
140
- # -- Example of sandwiching [wrapping]
141
- # -- ----------------------------------
142
- # --
143
- # -- [String] => "Hey secrets are juicy."
144
- # -- [To_Wrap] => "secrets"
145
- # -- [Prefix] => "[<-"
146
- # -- [Postfix] => "->]"
147
- # --
148
- # -- [String] => "Hey [<-secrets->] are juicy."
149
- # --
150
- # -- This string IS changed in place.
151
- # --
152
- def sandwich_substr to_wrap_str, prefix, postfix
153
-
154
- occurs_index = self.downcase.index to_wrap_str.downcase
155
- self.insert occurs_index, prefix
156
- shifted_index = occurs_index + prefix.length + to_wrap_str.length
157
- self.insert shifted_index, postfix
158
-
159
- end
160
-
161
-
162
- # --
163
- # -- Return [TRUE] if this string includes [every word] harboured
164
- # -- by the parameter array, else return [FALSE]. The "include"
165
- # -- is a case-sensitive search.
166
- # --
167
- # -- -----------
168
- # -- Parameter
169
- # -- -----------
170
- # --
171
- # -- word_array : array of string words for the inclusivity test
172
- # --
173
- # -- --------------------------------
174
- # -- Dependencies and Assumptions
175
- # -- --------------------------------
176
- # --
177
- # -- the parameter string is not nil
178
- # -- array can be [empty] but not nil
179
- # -- array contents are neither nil nor empty
180
- # --
181
- def includes_all? word_array
182
-
183
- Throw.if_nil self
184
- Throw.if_nil word_array
185
-
186
- word_array.each do |word|
187
-
188
- Throw.if_nil word
189
- return false unless self.include? word
190
-
191
- end
192
-
193
- return true
194
-
195
- end
196
-
197
-
198
- # --
199
- # -- return true if the string includes [ANY] word within the
200
- # -- parameter array, else return false. The "include" is done
201
- # -- as a case-sensitive search.
202
- # --
203
- # -- -----------
204
- # -- Parameter
205
- # -- -----------
206
- # --
207
- # -- word_array : array of string words for the inclusivity test
208
- # --
209
- # -- --------------------------------
210
- # -- Dependencies and Assumptions
211
- # -- --------------------------------
212
- # --
213
- # -- array can be [empty] but not nil
214
- # -- array contents are neither nil nor empty
215
- # --
216
- def includes_any? word_array
217
-
218
- Throw.if_nil self
219
- Throw.if_nil word_array
220
-
221
- word_array.each do |word|
222
-
223
- Throw.if_nil word
224
- return true if self.include? word
225
-
226
- end
227
-
228
- return false
229
-
230
- end
231
-
232
-
233
- # --
234
- # -- Encrypt this string with the parameter encryption/decryption key
235
- # -- and return the encrypted text as a new string.
236
- # --
237
- # -- decrypt_key => the key that will decrypt the output string
238
- # --
239
- # --
240
- def encrypt decrypt_key
241
-
242
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
243
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
244
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
245
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
246
-
247
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
248
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
249
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
250
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
251
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
252
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
253
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
254
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
255
-
256
- cipher = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC').encrypt
257
- cipher.key = Digest::SHA1.hexdigest decrypt_key
258
- crypted = cipher.update(self) + cipher.final
259
- encrypted_text = crypted.unpack('H*')[0].upcase
260
-
261
- return encrypted_text
262
-
263
- end
264
-
265
-
266
- # --
267
- # -- Decrypt this string with the parameter encryption/decryption key
268
- # -- and return the decrypted text as a new string.
269
- # --
270
- # -- encrypt_key => the key the input string was encrypted with
271
- # --
272
- # --
273
- def decrypt encrypt_key
274
-
275
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
276
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
277
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
278
- ## ----> Write a RE-CRYPT method that goes through a folder - decrypting and recrypting
279
-
280
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
281
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
282
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
283
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
284
- ###### ON Linux improve by changing to OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
285
- ###### ON Linux improve by changing to Digest::SHA2.hexdigest decrypt_key
286
-
287
- cipher = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC').decrypt
288
- cipher.key = Digest::SHA1.hexdigest encrypt_key
289
- uncrypted = [self].pack("H*").unpack("C*").pack("c*")
290
- decrypted_text = cipher.update(uncrypted) + cipher.final
291
-
292
- return decrypted_text
293
-
294
- end
295
-
296
-
297
- # --
298
- # -- Log the string which is expected to be delineated.
299
- # -- If the string originated from a file it will be logged
300
- # -- line by line. If no line delineation the string will be
301
- # -- dumped just as a blob.
302
- # --
303
- def log_lines
304
-
305
- self.each_line do |line|
306
- clean_line = line.chomp.gsub("\\n","")
307
- log.info(ere) { line } if clean_line.length > 0
308
- end
309
-
310
- end
311
-
312
- end