easy-crypto 0.1.7 → 0.2.4

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
  SHA256:
3
- metadata.gz: 31671eab7f89fa8fc412441808f40e9d9e4ccbe1a969070b5249d56a5cef5bcc
4
- data.tar.gz: 36d78c9ef113c69143b7588a3bf9a9884e0c9b2c0179efd6936622b9b41da401
3
+ metadata.gz: 32927f958e449242beee9d34653cfca538a61dfd1a7ab50c100144937377b420
4
+ data.tar.gz: 1088bc0207174f7b69cbc2e19125744a27e7ad0a7d603cd9cac6faa8267039b0
5
5
  SHA512:
6
- metadata.gz: c5ce234ec34ea19d1701f6c2810539013bb64c7af5ea9b19692995012f1db6398b199bbd9b7c830eb9de80513f58c724a4b4a336cfa552742251b0f4c1bc0e26
7
- data.tar.gz: 48282d3f7edef07f465e33e5adad4cfe8e597cfd8c4e5c497032eecc23fb23a82dc744efafc4745eab566e8470519b454e70fe9e2487d9994d1d5ead89b04d98
6
+ metadata.gz: f6b11db29f050998cd316ca0669819958cc5d78b21efd037a93b8f8858cb9eec652a3e7b1e8070ecdfe74e65728eae240216abe776d7ef16bf6071f0c8e03afa
7
+ data.tar.gz: 359e29a491171b1f5c1ae2c1c21651da73d4e96bf039f26eb7f20167ee6733c399ec5a62f6716bdede961990411a8c625e0a797544f0ebaacb64fc9a435448a2
@@ -0,0 +1,31 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-versions: ['2.6', '2.7', '3.0', 'jruby']
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby-versions }}
17
+ - name: Install dependencies
18
+ run: bundle install
19
+ - name: Run tests
20
+ run: bundle exec rake
21
+ - name: Deploy
22
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.ruby-versions == '3.0'
23
+ run: |
24
+ mkdir -p $HOME/.gem
25
+ touch $HOME/.gem/credentials
26
+ chmod 0600 $HOME/.gem/credentials
27
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
+ gem build *.gemspec
29
+ gem push *.gem
30
+ env:
31
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/Gemfile CHANGED
@@ -1,2 +1,5 @@
1
1
  source "https://rubygems.org"
2
- gemspec
2
+ gemspec
3
+
4
+ gem 'jruby-openssl', '~> 0.9', :platform => :jruby
5
+ gem 'openssl', '~> 2.1.2', :platform => :ruby
data/Gemfile.lock CHANGED
@@ -1,39 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- easy-crypto (0.1.7)
5
- openssl (~> 2.1.1, >= 2.1.1)
4
+ easy-crypto (0.2.4)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
9
  diff-lcs (1.3)
11
- ipaddr (1.2.2)
10
+ jruby-openssl (0.10.2-java)
12
11
  openssl (2.1.2)
13
- ipaddr
14
- rake (12.3.2)
15
- rspec (3.8.0)
16
- rspec-core (~> 3.8.0)
17
- rspec-expectations (~> 3.8.0)
18
- rspec-mocks (~> 3.8.0)
19
- rspec-core (3.8.0)
20
- rspec-support (~> 3.8.0)
21
- rspec-expectations (3.8.2)
12
+ rake (12.3.3)
13
+ rspec (3.9.0)
14
+ rspec-core (~> 3.9.0)
15
+ rspec-expectations (~> 3.9.0)
16
+ rspec-mocks (~> 3.9.0)
17
+ rspec-core (3.9.1)
18
+ rspec-support (~> 3.9.1)
19
+ rspec-expectations (3.9.0)
22
20
  diff-lcs (>= 1.2.0, < 2.0)
23
- rspec-support (~> 3.8.0)
24
- rspec-mocks (3.8.0)
21
+ rspec-support (~> 3.9.0)
22
+ rspec-mocks (3.9.1)
25
23
  diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.8.0)
27
- rspec-support (3.8.0)
24
+ rspec-support (~> 3.9.0)
25
+ rspec-support (3.9.2)
28
26
 
29
27
  PLATFORMS
28
+ java
30
29
  ruby
31
30
 
32
31
  DEPENDENCIES
33
- bundler (~> 1.16)
32
+ bundler (~> 2.2.23)
34
33
  easy-crypto!
34
+ jruby-openssl (~> 0.9)
35
+ openssl (~> 2.1.2)
35
36
  rake (~> 12.3)
36
37
  rspec (~> 3.0)
37
38
 
38
39
  BUNDLED WITH
39
- 1.17.3
40
+ 2.2.23
data/README.md CHANGED
@@ -31,7 +31,7 @@ plaintext = 'some data'
31
31
  ecrypto = EasyCrypto::Crypto.new
32
32
 
33
33
  encrypted = ecrypto.encrypt(password, plaintext)
34
- decrypted = ecrypto.encrypt(password, encrypted)
34
+ decrypted = ecrypto.decrypt(password, encrypted)
35
35
 
36
36
  decrypted == plaintext
37
37
  ```
data/easy-crypto.gemspec CHANGED
@@ -15,9 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.require_paths = ['lib']
17
17
 
18
- spec.add_development_dependency 'bundler', '~> 1.16'
18
+ spec.add_development_dependency 'bundler', '~> 2.2.23'
19
19
  spec.add_development_dependency 'rake', '~> 12.3'
20
20
  spec.add_development_dependency 'rspec', '~> 3.0'
21
-
22
- spec.add_runtime_dependency 'openssl', '~> 2.1.1', '>= 2.1.1'
23
21
  end
@@ -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.1.7'
4
+ VERSION = '0.2.4'
5
5
  end
data/repo-info.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "is_in_production": false,
3
+ "is_scannable": true,
4
+ "is_critical": false,
5
+ "contact": "G-GSUITE-Security@emarsys.com",
6
+ "hosted": null
7
+ }
@@ -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.1.7
4
+ version: 0.2.4
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-01-15 00:00:00.000000000 Z
11
+ date: 2021-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.2.23
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.2.23
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,26 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: openssl
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: 2.1.1
62
- - - "~>"
63
- - !ruby/object:Gem::Version
64
- version: 2.1.1
65
- type: :runtime
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: 2.1.1
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: 2.1.1
75
55
  description:
76
56
  email:
77
57
  - security@emarsys.com
@@ -79,8 +59,8 @@ executables: []
79
59
  extensions: []
80
60
  extra_rdoc_files: []
81
61
  files:
62
+ - ".github/workflows/ruby.yml"
82
63
  - ".gitignore"
83
- - ".travis.yml"
84
64
  - Gemfile
85
65
  - Gemfile.lock
86
66
  - LICENSE.txt
@@ -91,6 +71,7 @@ files:
91
71
  - lib/easycrypto/crypto.rb
92
72
  - lib/easycrypto/key.rb
93
73
  - lib/easycrypto/version.rb
74
+ - repo-info.json
94
75
  - spec/easycrypto/crypto_spec.rb
95
76
  - spec/easycrypto/key_spec.rb
96
77
  - spec/spec_helper.rb
@@ -113,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
94
  - !ruby/object:Gem::Version
114
95
  version: '0'
115
96
  requirements: []
116
- rubygems_version: 3.0.2
97
+ rubygems_version: 3.2.22
117
98
  signing_key:
118
99
  specification_version: 4
119
100
  summary: Provides simple wrappers around openssl crypto implementation.
data/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.1
5
- before_install: gem install bundler -v 1.16.1
6
- deploy:
7
- provider: rubygems
8
- api_key: ${RUBYGEMS_API_KEY}
9
- gem: easy-crypto
10
- gemspec: easy-crypto.gemspec
11
- skip_cleanup: true
12
- on:
13
- tags: true