symmetric-encryption 3.7.1 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -9
- data/lib/symmetric_encryption/reader.rb +8 -1
- data/lib/symmetric_encryption/version.rb +1 -1
- data/lib/symmetric_encryption/writer.rb +8 -1
- data/test/test_db.sqlite3 +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f92b1092b1192c42eb9b82d2ae059c548dbbe12d
|
4
|
+
data.tar.gz: dd540914e52a9a772bb860c9042d98c18e7eecaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54ff672e35c0d2bbe1545225e9da85294e032c5a0f8d211a74386659e7a9bafd354f1d4e8f64c922e6779ec0a51283a939303b7cc15c3ef27db52edd4c63e844
|
7
|
+
data.tar.gz: 5d1794d4203b3a1d951479c9be6d0802bb268ee8f4ce8cc795c215b35bae57b5a7ec8a5beddefd6b1ac17a007af8894f2b9f276402bb9c48fa115236043ef463
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
symmetric-encryption [](http://travis-ci.org/reidmorrison/symmetric-encryption)
|
1
|
+
symmetric-encryption [](http://travis-ci.org/reidmorrison/symmetric-encryption) 
|
2
2
|
====================
|
3
3
|
|
4
4
|
* http://github.com/reidmorrison/symmetric-encryption
|
@@ -19,14 +19,6 @@ expose all the encryption algorithms supported by OpenSSL.
|
|
19
19
|
|
20
20
|
For complete documentation see: http://reidmorrison.github.io/symmetric-encryption/
|
21
21
|
|
22
|
-
## Changes with V4
|
23
|
-
|
24
|
-
* V4 takes advantage of Ruby V2 named parameters and as such only works with
|
25
|
-
Ruby V2, and greater. This also means that for JRuby users it must be run in
|
26
|
-
V2 mode if not already running JRuby 9.0.0.0 or greater.
|
27
|
-
Users requiring compatibility with Ruby 1.8.7 and JRuby 1.7 ( 1.9 mode )
|
28
|
-
should continue to run Symmetric Encryption V3
|
29
|
-
|
30
22
|
## New features in V1.1 and V2
|
31
23
|
|
32
24
|
* Ability to randomly generate a new initialization vector (iv) with every
|
@@ -87,7 +87,7 @@ module SymmetricEncryption
|
|
87
87
|
file = Zlib::GzipReader.new(file) if !file.eof? && (file.compressed? || compress)
|
88
88
|
block ? block.call(file) : file
|
89
89
|
ensure
|
90
|
-
file.close if block && file
|
90
|
+
file.close if block && file && (file.respond_to?(:closed?) && !file.closed?)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -114,6 +114,7 @@ module SymmetricEncryption
|
|
114
114
|
@buffer_size = options.fetch(:buffer_size, 4096).to_i
|
115
115
|
@version = options[:version]
|
116
116
|
@header_present = false
|
117
|
+
@closed = false
|
117
118
|
|
118
119
|
raise(ArgumentError, 'Buffer size cannot be smaller than 128') unless @buffer_size >= 128
|
119
120
|
|
@@ -153,7 +154,9 @@ module SymmetricEncryption
|
|
153
154
|
# rather than creating an instance of Symmetric::EncryptedStream directly to
|
154
155
|
# ensure that the encrypted stream is closed before the stream itself is closed
|
155
156
|
def close(close_child_stream = true)
|
157
|
+
return if closed?
|
156
158
|
@ios.close if close_child_stream
|
159
|
+
@closed = true
|
157
160
|
end
|
158
161
|
|
159
162
|
# Flush the read stream
|
@@ -355,5 +358,9 @@ module SymmetricEncryption
|
|
355
358
|
@read_buffer << @stream_cipher.final if @ios.eof?
|
356
359
|
end
|
357
360
|
|
361
|
+
def closed?
|
362
|
+
@closed || @ios.respond_to?(:closed?) && @ios.closed?
|
363
|
+
end
|
364
|
+
|
358
365
|
end
|
359
366
|
end
|
@@ -109,7 +109,7 @@ module SymmetricEncryption
|
|
109
109
|
file = Zlib::GzipWriter.new(file) if compress
|
110
110
|
block ? block.call(file) : file
|
111
111
|
ensure
|
112
|
-
file.close if block && file
|
112
|
+
file.close if block && file && (file.respond_to?(:closed?) && !file.closed?)
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -152,6 +152,7 @@ module SymmetricEncryption
|
|
152
152
|
cipher_name))
|
153
153
|
end
|
154
154
|
@size = 0
|
155
|
+
@closed = false
|
155
156
|
end
|
156
157
|
|
157
158
|
# Close the IO Stream
|
@@ -167,11 +168,13 @@ module SymmetricEncryption
|
|
167
168
|
# rather than creating an instance of Symmetric::EncryptedStream directly to
|
168
169
|
# ensure that the encrypted stream is closed before the stream itself is closed
|
169
170
|
def close(close_child_stream = true)
|
171
|
+
return if closed?
|
170
172
|
if size > 0
|
171
173
|
final = @stream_cipher.final
|
172
174
|
@ios.write(final) if final.length > 0
|
173
175
|
end
|
174
176
|
@ios.close if close_child_stream
|
177
|
+
@closed = true
|
175
178
|
end
|
176
179
|
|
177
180
|
# Write to the IO Stream as encrypted data
|
@@ -204,6 +207,10 @@ module SymmetricEncryption
|
|
204
207
|
@ios.flush
|
205
208
|
end
|
206
209
|
|
210
|
+
def closed?
|
211
|
+
@closed || @ios.respond_to?(:closed?) && @ios.closed?
|
212
|
+
end
|
213
|
+
|
207
214
|
# Returns [Integer] the number of unencrypted and uncompressed bytes
|
208
215
|
# written to the file so far
|
209
216
|
attr_reader :size
|
data/test/test_db.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symmetric-encryption
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coercible
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.4.
|
100
|
+
rubygems_version: 2.4.8
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: Symmetric Encryption for Ruby, and Ruby on Rails
|