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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/lib/easycrypto/key.rb +5 -5
- data/lib/easycrypto/version.rb +1 -1
- data/spec/easycrypto/key_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bdfbd9e4e834ac62a97acaa8b04b1076070b47e360cd19969164adedfe72c43
|
4
|
+
data.tar.gz: d3dd3dc7ca6c11d774d9ee2c8b090d5df3a175cd83bfa9d77567482780eb3b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b4d70ca8890f3f9f330336e64ee7c77e6172e282fe06bc83d3a9320f72f89d2e6a7d4e101d63b5e1b6bc9f836b24a4833f78ab73984f655d6be36863729c213
|
7
|
+
data.tar.gz: 3eb6abe3aa0f4eb81f5d7795eb83da5ada327d62c36719791f1e8cadcbbad3a5ed557a62f86c1379916e38a8db677cd756da73f24ceaee8ca68bd7a05d3cf5c7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
easy-crypto (0.2.
|
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.
|
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)
|
data/lib/easycrypto/key.rb
CHANGED
@@ -22,12 +22,12 @@ module EasyCrypto
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.generate_with_salt(password, salt)
|
25
|
-
key = OpenSSL::
|
25
|
+
key = OpenSSL::PKCS5.pbkdf2_hmac(
|
26
26
|
password,
|
27
|
-
salt
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
salt,
|
28
|
+
Key::ITERATION_COUNT,
|
29
|
+
Key::KEY_LENGTH,
|
30
|
+
Key::HASH_ALGO
|
31
31
|
)
|
32
32
|
|
33
33
|
new(key, salt)
|
data/lib/easycrypto/version.rb
CHANGED
data/spec/easycrypto/key_spec.rb
CHANGED
@@ -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.
|
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
|
+
date: 2019-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|