aes256gcm_decrypt 0.0.2 → 1.0.0

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
  SHA1:
3
- metadata.gz: 0cd53e441e4de2f878cacf26642c881f10784dee
4
- data.tar.gz: af758a6f954de18d0456030d8c3d18529338e2d2
3
+ metadata.gz: 284ea0405d1679da805b31d952acc357e1c2a42d
4
+ data.tar.gz: 8b14e592ac2ef6a475b2153862001b9ec1983d16
5
5
  SHA512:
6
- metadata.gz: 43380846a99f752fdf9ad4e81847ed2f4bd43c2336b81d938e8415e1d9e46987d131fdcdd29d1e5b368323ee19206faf0bbb0e267a3482a0db326e8d32217edb
7
- data.tar.gz: 73ed2b8634cbd6c9f74e8b23098f10488c673b7173cec5d7c4d06bc38d987b8c70978c2875f2fca029d73e6918e04b02295d88b6a22cb6f10667ba5c341af469
6
+ metadata.gz: 0f4dea2a701d38fafd993af14e451a47f6b0ddb95d2d9079f955d2b0657c3a37db3a800e836e2112084601992854d6fb0acdd34d34b3166be3dc61f43f412086
7
+ data.tar.gz: 46cc4481a5a976287bb3e2e6169380d5eb6217bb629f857fd784376724af7c33bf48912e83170f83eea1916da6b2c1fcc9be15a55bd2a3f7b9bc3a1719dfb464
@@ -0,0 +1,14 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - 'aes256gcm_decrypt.gemspec'
6
+ - 'ext/aes256gcm_decrypt/extconf.rb'
7
+ - 'tmp/**/aes256gcm_decrypt.gemspec'
8
+ - 'tmp/**/extconf.rb'
9
+
10
+ Metrics/BlockLength:
11
+ Max: 48
12
+
13
+ Metrics/LineLength:
14
+ Max: 86
@@ -0,0 +1,7 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-05-23 10:32:04 -0400 using RuboCop version 0.55.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
data/Gemfile CHANGED
@@ -1,3 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
6
+
7
+ group :development do
8
+ gem 'rubocop', require: false
9
+ end
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake/extensiontask'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -10,4 +12,4 @@ RSpec::Core::RakeTask.new(:spec) do |task|
10
12
  end
11
13
 
12
14
  desc 'Compile extension and run specs'
13
- task :test => [:compile, :spec]
15
+ task test: %i[compile spec]
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = 'aes256gcm_decrypt'
3
- s.version = '0.0.2'
5
+ s.version = '1.0.0'
4
6
  s.summary = 'Decrypt AES256GCM-encrypted data in Apple Pay Payment Tokens'
5
7
  s.author = 'Clearhaus'
6
8
  s.homepage = 'https://github.com/clearhaus/aes256gcm_decrypt'
@@ -8,10 +10,10 @@ Gem::Specification.new do |s|
8
10
 
9
11
  s.files = `git ls-files -z`.split("\x0")
10
12
 
11
- s.extensions << "ext/aes256gcm_decrypt/extconf.rb"
13
+ s.extensions << 'ext/aes256gcm_decrypt/extconf.rb'
12
14
 
13
15
  s.required_ruby_version = '< 2.4'
14
16
 
15
- s.add_development_dependency "rake-compiler"
16
- s.add_development_dependency "rspec"
17
+ s.add_development_dependency 'rake-compiler'
18
+ s.add_development_dependency 'rspec'
17
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mkmf'
2
4
  extension_name = 'aes256gcm_decrypt'
3
5
  dir_config(extension_name)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aes256gcm_decrypt'
2
4
  require 'base64'
3
5
 
@@ -8,26 +10,26 @@ describe 'Aes256GcmDecrypt::decrypt' do
8
10
  end
9
11
 
10
12
  it 'decrypts correctly' do
11
- plaintext = Aes256GcmDecrypt::decrypt(@ciphertext_and_tag, @key)
13
+ plaintext = Aes256GcmDecrypt.decrypt(@ciphertext_and_tag, @key)
12
14
  expect(plaintext).to eq \
13
- '{"applicationPrimaryAccountNumber":"4109370251004320","applicationExp' +
14
- 'irationDate":"200731","currencyCode":"840","transactionAmount":100,"d' +
15
- 'eviceManufacturerIdentifier":"040010030273","paymentDataType":"3DSecu' +
16
- 're","paymentData":{"onlinePaymentCryptogram":"Af9x/QwAA/DjmU65oyc1MAA' +
15
+ '{"applicationPrimaryAccountNumber":"4109370251004320","applicationExp' \
16
+ 'irationDate":"200731","currencyCode":"840","transactionAmount":100,"d' \
17
+ 'eviceManufacturerIdentifier":"040010030273","paymentDataType":"3DSecu' \
18
+ 're","paymentData":{"onlinePaymentCryptogram":"Af9x/QwAA/DjmU65oyc1MAA' \
17
19
  'BAAA=","eciIndicator":"5"}}'
18
20
  end
19
21
 
20
22
  it 'detects wrong parameter types' do
21
- expect{Aes256GcmDecrypt::decrypt(42, @key)}.to \
23
+ expect { Aes256GcmDecrypt.decrypt(42, @key) }.to \
22
24
  raise_error(Aes256GcmDecrypt::InputError, 'ciphertext_and_tag must be a string')
23
- expect{Aes256GcmDecrypt::decrypt(@ciphertext_and_tag, 42)}.to \
25
+ expect { Aes256GcmDecrypt.decrypt(@ciphertext_and_tag, 42) }.to \
24
26
  raise_error(Aes256GcmDecrypt::InputError, 'key must be a string')
25
27
  end
26
28
 
27
29
  it 'detects too short ciphertext_and_tag' do
28
30
  (0..16).each do |i|
29
31
  ciphertext_and_tag = 'x' * i
30
- expect{Aes256GcmDecrypt::decrypt(ciphertext_and_tag, @key)}.to \
32
+ expect { Aes256GcmDecrypt.decrypt(ciphertext_and_tag, @key) }.to \
31
33
  raise_error(Aes256GcmDecrypt::InputError, 'ciphertext_and_tag too short')
32
34
  end
33
35
  end
@@ -35,26 +37,26 @@ describe 'Aes256GcmDecrypt::decrypt' do
35
37
  it 'detects wrong key length' do
36
38
  ((0..64).to_a - [32]).each do |i|
37
39
  key = 'x' * i
38
- expect{Aes256GcmDecrypt::decrypt(@ciphertext_and_tag, key)}.to \
40
+ expect { Aes256GcmDecrypt.decrypt(@ciphertext_and_tag, key) }.to \
39
41
  raise_error(Aes256GcmDecrypt::InputError, 'length of key must be 32')
40
42
  end
41
43
  end
42
44
 
43
45
  it 'detects tampering with the ciphertext' do
44
46
  @ciphertext_and_tag[0] = 'x'
45
- expect{Aes256GcmDecrypt::decrypt(@ciphertext_and_tag, @key)}.to \
47
+ expect { Aes256GcmDecrypt.decrypt(@ciphertext_and_tag, @key) }.to \
46
48
  raise_error(Aes256GcmDecrypt::AuthenticationError, 'Authentication failed')
47
49
  end
48
50
 
49
51
  it 'detects an incorrect tag' do
50
52
  @ciphertext_and_tag[-1] = 'x'
51
- expect{Aes256GcmDecrypt::decrypt(@ciphertext_and_tag, @key)}.to \
53
+ expect { Aes256GcmDecrypt.decrypt(@ciphertext_and_tag, @key) }.to \
52
54
  raise_error(Aes256GcmDecrypt::AuthenticationError, 'Authentication failed')
53
55
  end
54
56
 
55
57
  it 'detects an incorrect key' do
56
58
  @key[0] = 'x'
57
- expect{Aes256GcmDecrypt::decrypt(@ciphertext_and_tag, @key)}.to \
59
+ expect { Aes256GcmDecrypt.decrypt(@ciphertext_and_tag, @key) }.to \
58
60
  raise_error(Aes256GcmDecrypt::AuthenticationError, 'Authentication failed')
59
61
  end
60
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aes256gcm_decrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clearhaus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-23 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -45,6 +45,8 @@ extensions:
45
45
  - ext/aes256gcm_decrypt/extconf.rb
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".rubocop.yml"
49
+ - ".rubocop_todo.yml"
48
50
  - Gemfile
49
51
  - LICENSE.txt
50
52
  - README.md