edb 0.6 → 0.6.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: cf3bbfcc12b3ea9bf8b8d2da7e5acce50e69295f
4
- data.tar.gz: cdd15ff978c970706a69c1dc0b7f3ca1fd20a9a1
3
+ metadata.gz: e17dd73f932110daaefd68f24eba4d82996d1bfe
4
+ data.tar.gz: ed2f112288ebc8c6f2af8d419e68acfdf149ad3f
5
5
  SHA512:
6
- metadata.gz: 427fafb18b6e04e331d689b1efc4a0fa7d3cd4b29afa9f380d5695d3ee6ae54066e27c95ce6d1aef430a90d187d8fb65a23dd1b62f182c4e824ed9fe93d78f1f
7
- data.tar.gz: 14fbd57f7b9989d8ff27e8035aa3ebd79335b03bbcfcf46f6a82b324bf27b561c9873eddd60a1ac07d4983f4331f856cace405bf47c3aea773618d87a78d75a9
6
+ metadata.gz: 6117055df2f1cc9b1df10eee1c12feb4f5255efba51ac22a8be0645a188071a2c6aa1bc5648a6841f058f0268d122da22da76c019078bd730ff0b63779eec176
7
+ data.tar.gz: 024d5044d2df77d90363b419468fe31c1a4a91cfe4352660168f83eff45073765eba607a5c5f800cdaedcb5440414e7a3c1ea2e8d2938d354e73f23fc50381f3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- edb (0.6)
4
+ edb (0.6.1)
5
5
  aws-sdk (= 1.59.1)
6
6
  fast_secure_compare (~> 1.0)
7
7
  ftp_sync (~> 0.4)
@@ -35,8 +35,10 @@ module EDB
35
35
  cipher = OpenSSL::Cipher.new('AES-256-CBC')
36
36
  cipher.encrypt
37
37
 
38
- cipher.key, authentication_key = hash_keychain(::EDB.opts[:CRYPTOGRAPHY][:AES_256_CBC][:secret])
39
- cipher.iv = iv = cipher.random_iv
38
+ hkdf = HKDF.new(::EDB.opts[:CRYPTOGRAPHY][:AES_256_CBC][:secret])
39
+ cipher.key = hkdf.next_bytes(32)
40
+ authentication_key = hkdf.next_bytes(64)
41
+ cipher.iv = iv = cipher.random_iv
40
42
 
41
43
  ciphered_data = cipher.update(data) + cipher.final
42
44
  ciphered_data << iv
@@ -52,7 +54,10 @@ module EDB
52
54
  decipher.decrypt
53
55
 
54
56
  authentication = slice_str!(ciphered_data, 32)
55
- decipher.key, authentication_key = hash_keychain(::EDB.opts[:CRYPTOGRAPHY][:AES_256_CBC][:secret])
57
+
58
+ hkdf = HKDF.new(::EDB.opts[:CRYPTOGRAPHY][:AES_256_CBC][:secret])
59
+ decipher.key = hkdf.next_bytes(32)
60
+ authentication_key = hkdf.next_bytes(64)
56
61
 
57
62
  new_authentication = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), authentication_key, ciphered_data)
58
63
  raise 'Authentication failed.' unless FastSecureCompare.compare(authentication, new_authentication)
@@ -67,11 +72,6 @@ module EDB
67
72
  len = str.length
68
73
  str.slice!(len - n, len)
69
74
  end
70
-
71
- def hash_keychain(s)
72
- hkdf = HKDF.new(s)
73
- [ hkdf.next_bytes(64), hkdf.next_bytes(64) ]
74
- end
75
75
  end
76
76
  end
77
77
  end
@@ -23,5 +23,5 @@
23
23
  #++
24
24
 
25
25
  module EDB
26
- VERSION = '0.6'
26
+ VERSION = '0.6.1'
27
27
  end
@@ -45,13 +45,4 @@ describe EDB::Cryptography::AES_256_CBC do
45
45
  expect(str).to eq 'senjou'
46
46
  end
47
47
  end
48
-
49
- describe '#hash_keychain' do
50
- let(:keychain) { EDB::Cryptography::AES_256_CBC.instance_eval { hash_keychain('hitagi') } }
51
-
52
- it 'returns an array with two 64 bytes long keys' do
53
- expect(keychain[0].length).to be 64
54
- expect(keychain[1].length).to be 64
55
- end
56
- end
57
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edb
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano