easy-crypto 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2369e9cd1cf25eb55d1ffc9e3d055f5bdfccd482f185143dcdcb02a01f959b99
4
- data.tar.gz: 67321bb551ecb6bb8158f57b035d8ef0786c0349ee964c9e3e775a5a7d8240bd
3
+ metadata.gz: 7bdfbd9e4e834ac62a97acaa8b04b1076070b47e360cd19969164adedfe72c43
4
+ data.tar.gz: d3dd3dc7ca6c11d774d9ee2c8b090d5df3a175cd83bfa9d77567482780eb3b78
5
5
  SHA512:
6
- metadata.gz: 6c2ee0062fb829389884cb05b5da579d8b328a320bd7d64bfae3444d919364bcea5a4b569de1acdf675ef73976ab2bf96fba9f96bd84a79d3860d83c13638525
7
- data.tar.gz: dfb823270baea84b63da358c116b732ca7dc7449b13427519d2652c5878ee23c0ad16eee993489debeef6148cb937c9149d6ba4833281664c3384ff7d7db32f3
6
+ metadata.gz: 2b4d70ca8890f3f9f330336e64ee7c77e6172e282fe06bc83d3a9320f72f89d2e6a7d4e101d63b5e1b6bc9f836b24a4833f78ab73984f655d6be36863729c213
7
+ data.tar.gz: 3eb6abe3aa0f4eb81f5d7795eb83da5ada327d62c36719791f1e8cadcbbad3a5ed557a62f86c1379916e38a8db677cd756da73f24ceaee8ca68bd7a05d3cf5c7
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem 'jruby-openssl', '~> 0.10.2', '>= 0.10.2', :platform => :jruby
4
+ gem 'jruby-openssl', '~> 0.9', '>= 0.9', :platform => :jruby
5
5
  gem 'openssl', '~> 2.1.1', '>= 2.1.1', :platform => :ruby
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- easy-crypto (0.2.0)
4
+ easy-crypto (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -31,7 +31,7 @@ PLATFORMS
31
31
  DEPENDENCIES
32
32
  bundler (~> 1.16)
33
33
  easy-crypto!
34
- jruby-openssl (~> 0.10.2, >= 0.10.2)
34
+ jruby-openssl (~> 0.9, >= 0.9)
35
35
  openssl (~> 2.1.1, >= 2.1.1)
36
36
  rake (~> 12.3)
37
37
  rspec (~> 3.0)
@@ -22,12 +22,12 @@ module EasyCrypto
22
22
  end
23
23
 
24
24
  def self.generate_with_salt(password, salt)
25
- key = OpenSSL::KDF.pbkdf2_hmac(
25
+ key = OpenSSL::PKCS5.pbkdf2_hmac(
26
26
  password,
27
- salt: salt,
28
- iterations: Key::ITERATION_COUNT,
29
- length: Key::KEY_LENGTH,
30
- hash: Key::HASH_ALGO
27
+ salt,
28
+ Key::ITERATION_COUNT,
29
+ Key::KEY_LENGTH,
30
+ Key::HASH_ALGO
31
31
  )
32
32
 
33
33
  new(key, salt)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyCrypto
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -24,6 +24,13 @@ RSpec.describe EasyCrypto::Key do
24
24
  expect(key.salt).to eq salt
25
25
  end
26
26
 
27
+ it 'generates the expected key' do
28
+ key = EasyCrypto::Key.generate_with_salt('key password', salt)
29
+
30
+ expected_key = "\xC7\xE4\x89\xCB5\x86\xE0)Q)[u\xD6P\x87i\xC6\x13\xBE\xFE|\x19\x8A\xDB\xFB0\xB4\xE50\x12\x00\x95".force_encoding('ASCII-8BIT')
31
+ expect(key.key).to eq expected_key
32
+ end
33
+
27
34
  it 'generates the same key with the same password and salt' do
28
35
  key_1 = EasyCrypto::Key.generate_with_salt('key password', salt)
29
36
  key_2 = EasyCrypto::Key.generate_with_salt('key password', salt)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-crypto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emarsys Security
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-11 00:00:00.000000000 Z
11
+ date: 2019-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler