filesafe 3.1.0 → 3.1.1
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/VERSION.txt +1 -1
- data/lib/filesafe.rb +12 -13
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ba9550c3b8b18a9452579d37695430c35e73ab8
|
4
|
+
data.tar.gz: 64f823a312e18134a23c374ebaf8266ac2f7b9b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb19c35e91e82dfb7e7789803e2b3471ff1dc6c1ffcbc97924b5f51793d079a7f674ae257ae500ec63e733683b0e5623d460fa636734edb8d4d3f9af686bbe57
|
7
|
+
data.tar.gz: 3ab94cf7a4ff77e7a30c98bca7e58e6ae0412b0daa6b14555bbb455da3c1340dbeb128659c1b36f660f74a035028e1ece3f2e1a32066f896d4e090ede33278c3
|
data/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.1
|
data/lib/filesafe.rb
CHANGED
@@ -17,10 +17,10 @@
|
|
17
17
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
18
18
|
# copies of the Software, and to permit persons to whom the Software is
|
19
19
|
# furnished to do so, subject to the following conditions:
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# The above copyright notice and this permission notice shall be included in
|
22
22
|
# all copies or substantial portions of the Software.
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
25
25
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
26
26
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -44,7 +44,7 @@ module FileSafe
|
|
44
44
|
# Default cipher (AES-256 in CBC mode):
|
45
45
|
CIPHER = 'aes-256-cbc'
|
46
46
|
|
47
|
-
cipher = OpenSSL::Cipher
|
47
|
+
cipher = OpenSSL::Cipher.new(CIPHER)
|
48
48
|
|
49
49
|
# Cipher block length/size (128 bits/16 bytes for AES-256):
|
50
50
|
BLOCK_LEN = cipher.block_size
|
@@ -64,13 +64,13 @@ module FileSafe
|
|
64
64
|
# Default HMAC size/length (512 bits/64 bytes for HMAC-SHA-512):
|
65
65
|
HMAC_LEN = OpenSSL::HMAC.new('', HMAC_FUNC).digest.bytesize
|
66
66
|
|
67
|
-
# Default ciphertext file header size (key + IV + salt + HMAC = 1280 bits/160 bytes by default)
|
67
|
+
# Default ciphertext file header size (key + IV + salt + HMAC = 1280 bits/160 bytes by default)
|
68
68
|
HEADER_LEN = KEY_LEN + IV_LEN + SALT_LEN + HMAC_LEN
|
69
69
|
|
70
70
|
# Number of iterations to use in PBKDF2 (16384 by default):
|
71
71
|
ITERATIONS = 16384
|
72
72
|
|
73
|
-
# Number of bytes to read from plaintext/ciphertext files at a time (64KB by default):
|
73
|
+
# Number of bytes to read from plaintext/ciphertext files at a time (64KB by default):
|
74
74
|
FILE_CHUNK_LEN = 65536
|
75
75
|
|
76
76
|
# Read a passphrase from a terminal.
|
@@ -81,7 +81,7 @@ module FileSafe
|
|
81
81
|
tmp = HighLine.new.ask('Retype passphrase: '){|q| q.echo = '*' ; q.overwrite = true ; q.validate = nil }
|
82
82
|
return phrase if tmp == phrase
|
83
83
|
rescue Interrupt
|
84
|
-
exit -1
|
84
|
+
exit - 1
|
85
85
|
end while true
|
86
86
|
end
|
87
87
|
|
@@ -145,7 +145,7 @@ module FileSafe
|
|
145
145
|
|
146
146
|
## Encrypt the file key and IV using password-derived keying material:
|
147
147
|
keymaterial = pbkdf2(passphrase, salt, KEY_LEN + IV_LEN)
|
148
|
-
cipher = OpenSSL::Cipher
|
148
|
+
cipher = OpenSSL::Cipher.new(CIPHER)
|
149
149
|
cipher.encrypt
|
150
150
|
## No padding required for this operation since the file key + IV is
|
151
151
|
## an exact multiple of the cipher block length:
|
@@ -173,7 +173,7 @@ module FileSafe
|
|
173
173
|
hmac << encrypted_file_iv
|
174
174
|
|
175
175
|
## Encrypt file with file key + IV:
|
176
|
-
cipher = OpenSSL::Cipher
|
176
|
+
cipher = OpenSSL::Cipher.new(CIPHER)
|
177
177
|
cipher.encrypt
|
178
178
|
## Encryption of file contents uses PCKS#5 padding which OpenSSL should
|
179
179
|
## have enabled by default. Nevertheless, we explicitly enable it here:
|
@@ -275,7 +275,7 @@ module FileSafe
|
|
275
275
|
p.iterations = ITERATIONS
|
276
276
|
p.key_length = KEY_LEN + IV_LEN
|
277
277
|
end.bin_string
|
278
|
-
cipher = OpenSSL::Cipher
|
278
|
+
cipher = OpenSSL::Cipher.new(CIPHER)
|
279
279
|
cipher.decrypt
|
280
280
|
cipher.padding = 0 ## No padding is required for this operation
|
281
281
|
cipher.key = keymaterial[0,KEY_LEN]
|
@@ -286,7 +286,7 @@ module FileSafe
|
|
286
286
|
file_iv = keymaterial[KEY_LEN,IV_LEN]
|
287
287
|
|
288
288
|
## Decrypt file:
|
289
|
-
cipher = OpenSSL::Cipher
|
289
|
+
cipher = OpenSSL::Cipher.new(CIPHER)
|
290
290
|
cipher.decrypt
|
291
291
|
cipher.padding = 1 ## File contents use PCKS#5 padding,OpenSSL's default method
|
292
292
|
cipher.key = file_key
|
@@ -332,11 +332,11 @@ module FileSafe
|
|
332
332
|
end
|
333
333
|
end
|
334
334
|
end
|
335
|
-
|
335
|
+
|
336
336
|
# Execute PBKDF2 to generate the specified number of bytes of
|
337
337
|
# pseudo-random key material.
|
338
338
|
def self.pbkdf2(passphrase, salt, len)
|
339
|
-
|
339
|
+
PBKDF2.new do |p|
|
340
340
|
p.hash_function = HMAC_FUNC
|
341
341
|
p.password = passphrase
|
342
342
|
p.salt = salt
|
@@ -346,4 +346,3 @@ module FileSafe
|
|
346
346
|
end
|
347
347
|
|
348
348
|
end
|
349
|
-
|
metadata
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filesafe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron D. Gifford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pbkdf2-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.2'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.2'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.2.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: highline
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 1.6.1
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.6.1
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 1.6.1
|
50
|
-
- -
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.6.1
|
53
53
|
description: A utility script for encrypting and decrypting files using a randomly
|
@@ -79,17 +79,17 @@ require_paths:
|
|
79
79
|
- lib
|
80
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.6.12
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: Encrypt/decrypt files with a random 256-bit AES key secured by a passphrase
|