symmetric-encryption 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 231447a49387dc528e881059bf00023b1103cd42
4
- data.tar.gz: 6d3e9212d2925e2e93aa62d1e7ec998ca79992c2
3
+ metadata.gz: ac5f1b64a033b9aa7bd5b9dc2966318dab30609c
4
+ data.tar.gz: a5a010ede4476c92caab94fc5f7f697b8bd38395
5
5
  SHA512:
6
- metadata.gz: 3b824fdb557f6df9b9354e3706a6da0e3c04a9754f0b231c0ef1233e1423057bf0fb94ba1ceb4643bea3dec95b0cf595e85fc19f023b94585d8764a7c81b617a
7
- data.tar.gz: e602a1f3d44bec6575d43f69d975a6764d73faba374cb2b744c5e1aaa2744fda7bec2d028a9a525128f5e2fb0b3390b4256b2916d3b98faa6aad63a5565bd962
6
+ metadata.gz: 2d003387010b20ee1f61d59165982d54a26cc70d1bb95859215a156b3be65b5c1c2ccb59b43add0b85424b2a1f21a99a76e62405cf9375e2542880e56b9e8d58
7
+ data.tar.gz: 8b18f43416c1e8c6c5d30cba207727bc2ae29e17eb48cc264f53fbe1a37dee37e5b4fbe9cccd73f9a5ae6ec5482045f58c8415f0a37d247a81b63f6d4f5eaa37
data/Gemfile CHANGED
@@ -3,15 +3,15 @@ source :rubygems
3
3
  group :test do
4
4
  gem "shoulda"
5
5
 
6
- gem "activerecord"
7
- platforms :ruby do
8
- gem 'sqlite3'
9
- end
6
+ # Limited to Rails 3.2.x only because of Mongoid dependency below
7
+ # If Mongoid Appender is not used, Rails 4 should work fine
8
+ gem "activerecord", "~> 3.2.0"
9
+ gem 'sqlite3', :platform => :ruby
10
10
 
11
11
  platforms :jruby do
12
12
  gem 'jdbc-sqlite3'
13
13
  gem 'activerecord-jdbcsqlite3-adapter'
14
14
  end
15
15
 
16
- gem "mongoid"
16
+ gem "mongoid", "~> 3.1.0"
17
17
  end
@@ -13,28 +13,22 @@ GEM
13
13
  i18n (= 0.6.1)
14
14
  multi_json (~> 1.0)
15
15
  arel (3.0.2)
16
- bourne (1.4.0)
17
- mocha (~> 0.13.2)
18
16
  builder (3.0.4)
19
17
  i18n (0.6.1)
20
- metaclass (0.0.1)
21
- mocha (0.13.3)
22
- metaclass (~> 0.0.1)
23
- mongoid (3.1.3)
18
+ mongoid (3.1.4)
24
19
  activemodel (~> 3.2)
25
- moped (~> 1.4.2)
20
+ moped (~> 1.4)
26
21
  origin (~> 1.0)
27
22
  tzinfo (~> 0.3.22)
28
- moped (1.4.5)
29
- multi_json (1.7.2)
30
- origin (1.0.11)
31
- shoulda (3.4.0)
23
+ moped (1.5.0)
24
+ multi_json (1.7.7)
25
+ origin (1.1.0)
26
+ shoulda (3.5.0)
32
27
  shoulda-context (~> 1.0, >= 1.0.1)
33
- shoulda-matchers (~> 1.0, >= 1.4.1)
34
- shoulda-context (1.1.1)
35
- shoulda-matchers (1.5.6)
28
+ shoulda-matchers (>= 1.4.1, < 3.0)
29
+ shoulda-context (1.1.4)
30
+ shoulda-matchers (2.2.0)
36
31
  activesupport (>= 3.0.0)
37
- bourne (~> 1.3)
38
32
  sqlite3 (1.3.7)
39
33
  tzinfo (0.3.37)
40
34
 
@@ -42,9 +36,9 @@ PLATFORMS
42
36
  ruby
43
37
 
44
38
  DEPENDENCIES
45
- activerecord
39
+ activerecord (~> 3.2.0)
46
40
  activerecord-jdbcsqlite3-adapter
47
41
  jdbc-sqlite3
48
- mongoid
42
+ mongoid (~> 3.1.0)
49
43
  shoulda
50
44
  sqlite3
@@ -245,6 +245,7 @@ module SymmetricEncryption
245
245
  cfg[:key] = symmetric_key
246
246
  cfg[:iv] = config['iv'] || config['symmetric_iv']
247
247
  cfg[:cipher_name] = default_cipher
248
+ cfg[:version] = config['version']
248
249
 
249
250
  elsif ciphers = config['ciphers']
250
251
  raise "Missing mandatory config parameter 'private_rsa_key'" unless cfg[:private_rsa_key] = config['private_rsa_key']
@@ -296,7 +297,7 @@ module SymmetricEncryption
296
297
  # Load Encrypted Symmetric keys
297
298
  key_filename = cipher_conf[:key_filename]
298
299
  encrypted_key = begin
299
- File.read(key_filename)
300
+ File.read(key_filename, :open_args => ['rb'])
300
301
  rescue Errno::ENOENT
301
302
  puts "\nSymmetric Encryption key file: '#{key_filename}' not found or readable."
302
303
  puts "To generate the keys for the first time run: rails generate symmetric_encryption:new_keys\n\n"
@@ -305,7 +306,7 @@ module SymmetricEncryption
305
306
 
306
307
  iv_filename = cipher_conf[:iv_filename]
307
308
  encrypted_iv = begin
308
- File.read(iv_filename) if iv_filename
309
+ File.read(iv_filename, :open_args => ['rb']) if iv_filename
309
310
  rescue Errno::ENOENT
310
311
  puts "\nSymmetric Encryption initialization vector file: '#{iv_filename}' not found or readable."
311
312
  puts "To generate the keys for the first time run: rails generate symmetric_encryption:new_keys\n\n"
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module SymmetricEncryption #:nodoc
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
@@ -36,16 +36,16 @@ test:
36
36
 
37
37
  ciphers:
38
38
  # Current / Newest Symmetric Encryption Key
39
- - key_filename: /Users/rmorrison/Sandbox/symmetric-encryption/test/config/test_new.key
40
- iv_filename: /Users/rmorrison/Sandbox/symmetric-encryption/test/config/test_new.iv
39
+ - key_filename: test/config/test_new.key
40
+ iv_filename: test/config/test_new.iv
41
41
  cipher_name: aes-128-cbc
42
42
  # Base64 encode encrypted data without newlines
43
43
  encoding: base64strict
44
44
  version: 1
45
45
 
46
46
  # Previous Symmetric Encryption Key
47
- - key_filename: /Users/rmorrison/Sandbox/symmetric-encryption/test/config/test_secondary_1.key
48
- iv_filename: /Users/rmorrison/Sandbox/symmetric-encryption/test/config/test_secondary_1.iv
47
+ - key_filename: test/config/test_secondary_1.key
48
+ iv_filename: test/config/test_secondary_1.iv
49
49
  cipher_name: aes-128-cbc
50
50
  # Base64 encode encrypted data without newlines
51
51
  encoding: base64
@@ -113,7 +113,7 @@ class ReaderTest < Test::Unit::TestCase
113
113
  when :data
114
114
  # Create encrypted file
115
115
  @eof = false
116
- @filename = '._test'
116
+ @filename = '_test'
117
117
  @header = (options[:header] != false)
118
118
  SymmetricEncryption::Writer.open(@filename, options) do |file|
119
119
  @data.inject(0) {|sum,str| sum + file.write(str)}
@@ -121,7 +121,7 @@ class ReaderTest < Test::Unit::TestCase
121
121
  when :empty
122
122
  @data_str = ''
123
123
  @eof = true
124
- @filename = '._test_empty'
124
+ @filename = '_test_empty'
125
125
  @header = (options[:header] != false)
126
126
  SymmetricEncryption::Writer.open(@filename, options) do |file|
127
127
  # Leave data portion empty
@@ -244,7 +244,7 @@ class ReaderTest < Test::Unit::TestCase
244
244
 
245
245
  context "reading from files with previous keys" do
246
246
  setup do
247
- @filename = '._test'
247
+ @filename = '_test'
248
248
  # Create encrypted file with old encryption key
249
249
  SymmetricEncryption::Writer.open(@filename, :version => 0) do |file|
250
250
  @data.inject(0) {|sum,str| sum + file.write(str)}
@@ -282,7 +282,7 @@ class ReaderTest < Test::Unit::TestCase
282
282
 
283
283
  context "reading from files with previous keys without a header" do
284
284
  setup do
285
- @filename = '._test'
285
+ @filename = '_test'
286
286
  # Create encrypted file with old encryption key
287
287
  SymmetricEncryption::Writer.open(@filename, :version => 0, :header => false, :random_key => false) do |file|
288
288
  @data.inject(0) {|sum,str| sum + file.write(str)}
@@ -290,7 +290,11 @@ class ReaderTest < Test::Unit::TestCase
290
290
  end
291
291
 
292
292
  teardown do
293
- File.delete(@filename) if File.exist?(@filename)
293
+ begin
294
+ File.delete(@filename) if File.exist?(@filename)
295
+ rescue Errno::EACCES
296
+ # Required for Windows
297
+ end
294
298
  end
295
299
 
296
300
  should "decrypt from file in a single read" do
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: 2.0.1
4
+ version: 2.0.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: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: SymmetricEncryption supports encrypting ActiveRecord data, Mongoid data,
14
14
  passwords in configuration files, encrypting and decrypting of large files through