symmetric-encryption 3.8.0 → 3.8.1

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: 6bf012ca0a4d3ce067a363f363168e4fcc5bebf9
4
- data.tar.gz: 005d3a55560d79f658464ba189957f5349d221e2
3
+ metadata.gz: e7fcf976eaf8d967c7cf4a3559b5c698640dd401
4
+ data.tar.gz: ecf5b60f2ded095107ee5b78eed6af61c0c43b6a
5
5
  SHA512:
6
- metadata.gz: 243de98a4079b584cd215f81f15caf4e6d6985047804a6e74dbcd46e25dbfd45a7f2a3e5d6610c47309a54b0845f6bc10bbb2d7cdd9ec8ac05e5b81361335647
7
- data.tar.gz: 56b65cf943afec131341309628ff39101be17321b194f0136cf593d67030df52b41ea1a91abcc445805c3dd2882c5802bb5a84376e352f6282d1f415342156bc
6
+ metadata.gz: e92874d2946c20f582dfb8ae1688d8203022d8e44da745c544b809dbe3afd4bf7bc37432a568ff9b59102283dce16105ba71873d5a5485336e5e77ae800f500c
7
+ data.tar.gz: 7b9213456f5e4b7232269197917afe1f21138aa39fe8fce172e3efdacd0efb55af59cd2b9ca0a1406845bb433ef0e4e6cdbb2a8577aed2a7ea81de2e82ff6653
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # symmetric-encryption
2
- ![](https://img.shields.io/gem/v/symmetric-encryption.svg) ![](https://secure.travis-ci.org/reidmorrison/symmetric-encryption.png?branch=master) ![](https://img.shields.io/gem/dt/symmetric-encryption.svg) ![](https://img.shields.io/badge/status-production%20ready-blue.svg)
2
+ ![](https://img.shields.io/gem/v/symmetric-encryption.svg) ![](https://img.shields.io/travis/reidmorrison/symmetric-encryption.svg) ![](https://img.shields.io/gem/dt/symmetric-encryption.svg) ![](https://img.shields.io/badge/status-production%20ready-blue.svg)
3
3
 
4
4
  * http://github.com/reidmorrison/symmetric-encryption
5
5
 
@@ -92,18 +92,16 @@ may have backward compatibility issues:
92
92
  compression.
93
93
  * Default: false
94
94
 
95
- ## Versioning
96
-
97
- This project uses [Semantic Versioning](http://semver.org/).
98
-
99
95
  ## Author
100
96
 
101
97
  [Reid Morrison](https://github.com/reidmorrison)
102
98
 
103
- ## Contributors
104
-
105
99
  [Contributors](https://github.com/reidmorrison/symmetric-encryption/graphs/contributors)
106
100
 
101
+ ## Versioning
102
+
103
+ This project uses [Semantic Versioning](http://semver.org/).
104
+
107
105
  ## Disclaimer
108
106
 
109
107
  Although this library has assisted in meeting PCI Compliance and has passed
@@ -5,11 +5,12 @@
5
5
  # For the development and test environments the test symmetric encryption keys
6
6
  # can be placed directly in the source code.
7
7
  # And therefore no RSA private key is required
8
- development: &development_defaults
9
- key: 1234567890ABCDEF1234567890ABCDEF
10
- iv: 1234567890ABCDEF
11
- cipher_name: aes-128-cbc
12
- encoding: :base64strict
8
+ development: &development_defaults
9
+ key: 1234567890ABCDEF1234567890ABCDEF
10
+ iv: 1234567890ABCDEF
11
+ cipher_name: aes-128-cbc
12
+ encoding: :base64strict
13
+ always_add_header: true
13
14
 
14
15
  test:
15
16
  <<: *development_defaults
@@ -26,12 +27,12 @@ release:
26
27
  -
27
28
  # Filename containing Symmetric Encryption Key encrypted using the
28
29
  # RSA public key derived from the private key above
29
- key_filename: <%= File.join(key_path, "#{app_name}_release.key") %>
30
- iv_filename: <%= File.join(key_path, "#{app_name}_release.iv") %>
31
- cipher_name: aes-256-cbc
32
- # Base64 encode encrypted data without newlines
33
- encoding: :base64strict
34
- version: 1
30
+ key_filename: <%= File.join(key_path, "#{app_name}_release.key") %>
31
+ iv_filename: <%= File.join(key_path, "#{app_name}_release.iv") %>
32
+ cipher_name: aes-256-cbc
33
+ encoding: :base64strict
34
+ version: 1
35
+ always_add_header: true
35
36
 
36
37
  production:
37
38
  # Since the key to encrypt and decrypt with must NOT be stored along with the
@@ -45,9 +46,9 @@ production:
45
46
  -
46
47
  # Filename containing Symmetric Encryption Key encrypted using the
47
48
  # RSA public key derived from the private key above
48
- key_filename: <%= File.join(key_path, "#{app_name}_production.key") %>
49
- iv_filename: <%= File.join(key_path, "#{app_name}_production.iv") %>
50
- cipher_name: aes-256-cbc
51
- # Base64 encode encrypted data without newlines
52
- encoding: :base64strict
53
- version: 1
49
+ key_filename: <%= File.join(key_path, "#{app_name}_production.key") %>
50
+ iv_filename: <%= File.join(key_path, "#{app_name}_production.iv") %>
51
+ cipher_name: aes-256-cbc
52
+ encoding: :base64strict
53
+ version: 1
54
+ always_add_header: true
@@ -37,12 +37,12 @@ release:
37
37
  -
38
38
  # Filename containing Symmetric Encryption Key encrypted using the
39
39
  # RSA public key derived from the private key above
40
- encrypted_key: "<%= '<' + "%= ENV['RELEASE_KEY1'] %" + '>' %>"
41
- iv: "<%= iv %>"
42
- cipher_name: <%= cipher_name %>
43
- # Base64 encode encrypted data without newlines
44
- encoding: :base64strict
45
- version: 1
40
+ encrypted_key: "<%= '<' + "%= ENV['RELEASE_KEY1'] %" + '>' %>"
41
+ iv: "<%= iv %>"
42
+ cipher_name: <%= cipher_name %>
43
+ encoding: :base64strict
44
+ version: 1
45
+ always_add_header: true
46
46
 
47
47
  <%
48
48
  cipher_name = 'aes-256-cbc'
@@ -67,9 +67,9 @@ production:
67
67
  -
68
68
  # Filename containing Symmetric Encryption Key encrypted using the
69
69
  # RSA public key derived from the private key above
70
- encrypted_key: "<%= '<' + "%= ENV['PRODUCTION_KEY1'] %" + '>' %>"
71
- iv: "<%= iv %>"
72
- cipher_name: <%= cipher_name %>
73
- # Base64 encode encrypted data without newlines
74
- encoding: :base64strict
75
- version: 1
70
+ encrypted_key: "<%= '<' + "%= ENV['PRODUCTION_KEY1'] %" + '>' %>"
71
+ iv: "<%= iv %>"
72
+ cipher_name: <%= cipher_name %>
73
+ encoding: :base64strict
74
+ version: 1
75
+ always_add_header: true
@@ -57,7 +57,7 @@ module SymmetricEncryption
57
57
  # See: #initialize for parameters
58
58
  def self.generate_random_keys(params)
59
59
  environment = params[:environment]
60
- private_rsa_key = config[:private_rsa_key]
60
+ private_rsa_key = params[:private_rsa_key]
61
61
  rsa = OpenSSL::PKey::RSA.new(private_rsa_key) if private_rsa_key
62
62
  key_pair = SymmetricEncryption::Cipher.random_key_pair(params[:cipher_name] || 'aes-256-cbc')
63
63
  key = key_pair[:key]
@@ -67,7 +67,7 @@ module SymmetricEncryption
67
67
  if params.has_key?(:key)
68
68
  puts 'Put this value in your configuration file for :key'
69
69
  p key
70
- elsif file_name = config.delete(:key_filename)
70
+ elsif file_name = params.delete(:key_filename)
71
71
  write_to_file(file_name, key, rsa)
72
72
  puts("Please copy #{file_name} to the other servers in #{environment}.")
73
73
  elsif params.has_key?(:encrypted_key)
@@ -83,7 +83,7 @@ module SymmetricEncryption
83
83
  if params.has_key?(:iv)
84
84
  puts 'Put this value in your configuration file for :iv'
85
85
  p iv
86
- elsif file_name = config.delete(:iv_filename)
86
+ elsif file_name = params.delete(:iv_filename)
87
87
  write_to_file(file_name, iv, rsa)
88
88
  puts("Please copy #{file_name} to the other servers in #{environment}.")
89
89
  elsif params.has_key?(:encrypted_iv)
@@ -562,7 +562,7 @@ module SymmetricEncryption
562
562
 
563
563
  # Save symmetric key after encrypting it with the private RSA key
564
564
  # Backing up existing files if present
565
- def write_to_file(file_name, key, rsa)
565
+ def self.write_to_file(file_name, key, rsa)
566
566
  raise(SymmetricEncryption::ConfigError, 'Missing mandatory config parameter :private_rsa_key when filename key is used') unless rsa
567
567
  File.rename(file_name, "#{file_name}.#{Time.now.to_i}") if File.exist?(file_name)
568
568
  File.open(file_name, 'wb') { |file| file.write(rsa.public_encrypt(key)) }
@@ -271,7 +271,8 @@ module SymmetricEncryption
271
271
 
272
272
  # Only regenerating the first configured cipher
273
273
  cipher_config = config[:ciphers].first
274
- Cipher.generate_random_keys({environment: environment, private_rsa_key: config[:private_rsa_key]}.merge(cipher_config))
274
+ key_config = {environment: environment, private_rsa_key: config[:private_rsa_key]}
275
+ Cipher.generate_random_keys(key_config.merge(cipher_config))
275
276
  end
276
277
 
277
278
  # Generate a 22 character random password
@@ -1,3 +1,3 @@
1
1
  module SymmetricEncryption #:nodoc
2
- VERSION = '3.8.0'
2
+ VERSION = '3.8.1'
3
3
  end
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.8.0
4
+ version: 3.8.1
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-10-17 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coercible