gala 0.3.2 → 0.5.0

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
- SHA1:
3
- metadata.gz: 4227537dc0b299428df76e8558c2191c30d065b0
4
- data.tar.gz: 87347e9b12ab6fb03644a13c18c171d4f90801cd
2
+ SHA256:
3
+ metadata.gz: 93b93339726eda34b17a867a4f6b70798b1c78694f877fe4ba8cef1d06fc1571
4
+ data.tar.gz: 0550f14686b92763f783ad2d41c24573cf7fde32b2ce2b56f6c8743ae98301c5
5
5
  SHA512:
6
- metadata.gz: 04c1581817cf346028e8b575802150c3e4639e7b87c44f49c35b83058c939c0d7eff0f5ebc9e98d0e9a14dbb535f5688de72c014ead1a7169727f637c735c0a7
7
- data.tar.gz: 0f12a08997bdba5a6996811f2713c6b68d7cca61de3835b712d4786f6f62c949b2fb930140e912d3a1852ed21458480ae79bab5e58e2d5253e95c86b0ec845a1
6
+ metadata.gz: 6516487b176ac874ba4d893a8ae769c46d6d8b1613a859a2d09cefea7dccc0216d9875aa175f0fc174e5bf372a6ca9e7c390c40be35aef91e1c8f9df5bba1959
7
+ data.tar.gz: 9d85d6d765b8f66a8088834217c5e09d1f440b8d16bca4ddaddf523563b72cee434a3022f2a1a40f3cb42dca8d99fbb8082debc2e2b747a0d1e8c567fced37b0
data/.circleci/config.yml CHANGED
@@ -1,22 +1,15 @@
1
1
  version: 2
2
2
  jobs:
3
- ruby-2.1:
3
+ ruby-2.4:
4
4
  docker:
5
- - image: circleci/ruby:2.1.10
5
+ - image: circleci/ruby:2.4.4
6
6
  steps:
7
7
  - checkout
8
8
  - run: bundle
9
9
  - run: rake test
10
- ruby-2.2:
10
+ ruby-2.5:
11
11
  docker:
12
- - image: circleci/ruby:2.2.10
13
- steps:
14
- - checkout
15
- - run: bundle
16
- - run: rake test
17
- ruby-2.3:
18
- docker:
19
- - image: circleci/ruby:2.3.7
12
+ - image: circleci/ruby:2.5.1
20
13
  steps:
21
14
  - checkout
22
15
  - run: bundle
@@ -25,6 +18,5 @@ workflows:
25
18
  version: 2
26
19
  rubies:
27
20
  jobs:
28
- - ruby-2.1
29
- - ruby-2.2
30
- - ruby-2.3
21
+ - ruby-2.4
22
+ - ruby-2.5
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- gemspec
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'aead', git: 'https://github.com/Shopify/aead.git', ref: '340e7718d8bd9c1fcf3c443e32f439436ea2b70d'
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,35 +1,24 @@
1
- GIT
2
- remote: https://github.com/Shopify/aead.git
3
- revision: 340e7718d8bd9c1fcf3c443e32f439436ea2b70d
4
- ref: 340e7718d8bd9c1fcf3c443e32f439436ea2b70d
5
- specs:
6
- aead (1.8.2)
7
- macaddr (~> 1)
8
-
9
1
  PATH
10
2
  remote: .
11
3
  specs:
12
- gala (0.3.1)
13
- aead (~> 1.8)
4
+ gala (0.4.0)
5
+ openssl (= 3.1.0)
14
6
 
15
7
  GEM
16
8
  remote: https://rubygems.org/
17
9
  specs:
18
- macaddr (1.7.1)
19
- systemu (~> 2.6.2)
20
- minitest (5.11.3)
21
- rake (12.0.0)
22
- systemu (2.6.5)
10
+ minitest (5.18.0)
11
+ openssl (3.1.0)
12
+ rake (12.3.3)
23
13
 
24
14
  PLATFORMS
25
15
  ruby
26
16
 
27
17
  DEPENDENCIES
28
- aead!
29
18
  bundler (~> 1.14)
30
19
  gala!
31
20
  minitest
32
21
  rake (~> 12.0)
33
22
 
34
23
  BUNDLED WITH
35
- 1.15.4
24
+ 1.17.3
data/README.md CHANGED
@@ -1,23 +1,28 @@
1
1
  # Gala
2
2
 
3
+ [![CircleCI](https://circleci.com/gh/spreedly/gala.svg?style=svg)](https://circleci.com/gh/spreedly/gala)
4
+
3
5
  Named after the [Gala apple](http://en.wikipedia.org/wiki/Gala_(apple)), Gala is a Ruby library for decrypting [Apple Pay payment tokens](https://developer.apple.com/library/ios/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html).
4
6
 
5
7
  Gala is available under the MIT License.
6
8
 
9
+ ## Ruby support
10
+
11
+ * For Ruby v2.3 and below, please use the [legacy-ruby branch](https://github.com/spreedly/gala/commits/legacy-ruby), or specify gala v0.3.2.
12
+ * For Ruby >= 2.4, use the master branch or specify gala v0.4 and above
13
+
7
14
  ## Install
8
15
 
9
- Add both `gala` and `aead` to your `Gemfile`. Specifying `aead` is necessary to pull in the Shopify version of the library which has been updated to support Ruby versions 2.2 and above.
16
+ Add `gala` to your `Gemfile`.
10
17
 
11
18
  ```ruby
12
- gem "gala", "~> 0.3.1"
13
- gem 'aead', git: 'https://github.com/Shopify/aead.git', ref: '340e7718d8bd9c1fcf3c443e32f439436ea2b70d'
19
+ gem "gala", "~> 0.4.0"
14
20
  ```
15
21
 
16
22
  If you need to track a development branch or reference functionality not yet contained in the RubyGem release you can specify the gala repo directly.
17
23
 
18
24
  ```ruby
19
25
  gem "gala", git: "https://github.com/spreedly/gala.git", ref: :master
20
- gem 'aead', git: 'https://github.com/Shopify/aead.git', ref: '340e7718d8bd9c1fcf3c443e32f439436ea2b70d'
21
26
  ```
22
27
 
23
28
  Then `bundle install` to fetch Gala into your local environment.
@@ -91,6 +96,15 @@ $ rake release
91
96
 
92
97
  ## Changelog
93
98
 
99
+ ### v0.5.0
100
+
101
+ *Update Openssl to support Ruby 3
102
+
103
+ ### v0.4.0
104
+
105
+ * Remove unmaintained `aead` gem dependency
106
+ * Rely on Ruby 2.4 openssl support for aes-256-gcm ciphers (and specifying the initialization vector length).
107
+
94
108
  ### v0.3.2
95
109
 
96
110
  * Setup CircleCI for more comprehensive Ruby version/compatibility testing
data/gala.gemspec CHANGED
@@ -17,11 +17,11 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
18
18
  spec.test_files = `git ls-files -- test/*`.split("\n")
19
19
  spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.required_ruby_version = ">= 1.8.7"
22
+ spec.required_ruby_version = '>= 2.6.0'
23
23
 
24
- spec.add_runtime_dependency 'aead', '~> 1.8'
24
+ spec.add_runtime_dependency 'openssl', '3.1.0'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '~> 1.14'
27
27
  spec.add_development_dependency 'rake', '~> 12.0'
@@ -1,6 +1,5 @@
1
1
  require 'openssl'
2
2
  require 'base64'
3
- require 'aead'
4
3
 
5
4
  module Gala
6
5
  class PaymentToken
@@ -56,7 +55,7 @@ module Gala
56
55
  raise InvalidSignatureError, "Signature does not contain the correct custom OIDs." unless leaf_cert && intermediate_cert
57
56
 
58
57
  # Ensure that the root CA is the Apple Root CA - G3
59
- root_cert = certificate = OpenSSL::X509::Certificate.new(APPLE_ROOT_CERT)
58
+ root_cert = OpenSSL::X509::Certificate.new(APPLE_ROOT_CERT)
60
59
 
61
60
  # Ensure that there is a valid X.509 chain of trust from the signature to the root CA
62
61
  raise InvalidSignatureError, "Unable to verify a valid chain of trust from signature to root certificate." unless chain_of_trust_verified?(leaf_cert, intermediate_cert, root_cert)
@@ -111,11 +110,26 @@ module Gala
111
110
  end
112
111
 
113
112
  def decrypt(encrypted_data, symmetric_key)
114
- init_length = 16
115
- init_vector = 0.chr * init_length
116
- mode = ::AEAD::Cipher.new('aes-256-gcm')
117
- cipher = mode.new(symmetric_key, iv_len: init_length)
118
- cipher.decrypt(init_vector, '', encrypted_data)
113
+ # Initialization vector of 16 null bytes
114
+ iv_length = 16
115
+ # 0.chr => "\x00"
116
+ iv = 0.chr * iv_length
117
+
118
+ # Last 16 bytes (iv_length) of encrypted data
119
+ tag = encrypted_data[-iv_length..-1]
120
+ # Data without tag
121
+ encrypted_data = encrypted_data[0..(-iv_length - 1)]
122
+
123
+ cipher = OpenSSL::Cipher.new("aes-256-gcm").decrypt
124
+ cipher.key = symmetric_key
125
+ cipher.iv_len = iv_length
126
+ cipher.iv = iv
127
+
128
+ # Decipher without associated authentication data
129
+ cipher.auth_tag = tag
130
+ cipher.auth_data = ''
131
+
132
+ cipher.update(encrypted_data) + cipher.final
119
133
  end
120
134
  end
121
135
  end
data/lib/gala/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gala
2
- VERSION = "0.3.2" unless defined? Gala::VERSION
2
+ VERSION = "0.5.0" unless defined? Gala::VERSION
3
3
  end
@@ -1,26 +1,27 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIEcDCCBBagAwIBAgIIUyrEM4IzBHQwCgYIKoZIzj0EAwIwgYAxNDAyBgNVBAMM
2
+ MIIEhTCCBCugAwIBAgIIaw5PZcTrT70wCgYIKoZIzj0EAwIwgYAxNDAyBgNVBAMM
3
3
  K0FwcGxlIFdvcmxkd2lkZSBEZXZlbG9wZXIgUmVsYXRpb25zIENBIC0gRzIxJjAk
4
4
  BgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApB
5
- cHBsZSBJbmMuMQswCQYDVQQGEwJVUzAeFw0xNDEwMjYxMjEwMTBaFw0xNjExMjQx
6
- MjEwMTBaMIGhMS4wLAYKCZImiZPyLGQBAQwebWVyY2hhbnQuY29tLnNlYXRnZWVr
7
- LlNlYXRHZWVrMTQwMgYDVQQDDCtNZXJjaGFudCBJRDogbWVyY2hhbnQuY29tLnNl
8
- YXRnZWVrLlNlYXRHZWVrMRMwEQYDVQQLDAo5QjNRWTlXQlo1MRcwFQYDVQQKDA5T
9
- ZWF0R2VlaywgSW5jLjELMAkGA1UEBhMCVVMwWTATBgcqhkjOPQIBBggqhkjOPQMB
10
- BwNCAAQPjiA1kTEodST2wy5d5kQFrM0D5qBX9Ukry8W6D+vC7OqbMoTm/upRM1GR
11
- HeA2LaVTrwAnpGhoO0ETqYF2Nu4Vo4ICVTCCAlEwRwYIKwYBBQUHAQEEOzA5MDcG
12
- CCsGAQUFBzABhitodH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TFLA66G9MA4GA1UdDwEB/wQEAwIDKDBPBgkqhkiG92NkBiAE
23
+ QgxAMzU4REE1ODkwQjk1NTVDMEE5RUZCODRCNUNENkZGMDRCRkRDRDVBQUJGNURD
24
+ MTRCOTg3MkQ4REY1MUVBRjQzOTAKBggqhkjOPQQDAgNIADBFAiBbRM0mTHB/oMfN
25
+ S80yvbqIS7bVZcvhlBRZHKsejOJ2OAIhANOXoD6Fmqk2GxMePAnMqDchAgi7Ft/D
26
+ KRykbt8Tfh8j
26
27
  -----END CERTIFICATE-----
@@ -1,5 +1,5 @@
1
1
  -----BEGIN EC PRIVATE KEY-----
2
- MHcCAQEEIDqrpF0KEFW4Ncb76vyBi3StFLiT222sFC0wC3LsP1M9oAoGCCqGSM49
3
- AwEHoUQDQgAED44gNZExKHUk9sMuXeZEBazNA+agV/VJK8vFug/rwuzqmzKE5v7q
4
- UTNRkR3gNi2lU68AJ6RoaDtBE6mBdjbuFQ==
2
+ MHcCAQEEICmvB7bzRczaJX05lCTK2ueRVRAAivM/CgbHyOaIcqW1oAoGCCqGSM49
3
+ AwEHoUQDQgAE4pUGHJqfJCucG40MvdGqTwvYRz2N9WvCtOHdtAuNf1vB2MPZyLsq
4
+ U32Z3a5z1WcWK6OHmfDDSqOrfQq7UXlQgA==
5
5
  -----END EC PRIVATE KEY-----
@@ -1,10 +1,10 @@
1
1
  {
2
- "version":"EC_v1",
3
- "data":"4OZho15e9Yp5K0EtKergKzeRpPAjnKHwmSNnagxhjwhKQ5d29sfTXjdbh1CtTJ4DYjsD6kfulNUnYmBTsruphBz7RRVI1WI8P0LrmfTnImjcq1mi+BRN7EtR2y6MkDmAr78anff91hlc+x8eWD/NpO/oZ1ey5qV5RBy/Jp5zh6ndVUVq8MHHhvQv4pLy5Tfi57Yo4RUhAsyXyTh4x/p1360BZmoWomK15NcJfUmoUCuwEYoi7xUkRwNr1z4MKnzMfneSRpUgdc0wADMeB6u1jcuwqQnnh2cusiagOTCfD6jO6tmouvu6KO54uU7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DExOTAzMDZaMCoGCSqGSIb3DQEJNDEdMBswDQYJYIZIAWUDBAIBBQChCgYIKoZIzj0EAwIwLwYJKoZIhvcNAQkEMSIEIJp5MA0izHSXJb0IZHNgCPFTzNVvCl93e6CLM+iDGmfjMAoGCCqGSM49BAMCBEgwRgIhAPpny9Qbxe1wpRcRK6kW8hfaT2G8L0cK55frTPNOjiw+AiEA1na4JJngB+yKCLij5V5JH2daE7Xcc91YbYywWL7QVSgAAAAAAAA=",
5
+ "header": {
6
+ "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHqqqjg3xlLn9YH2fEN1Gq3Z0IUJY1KZrX9/ZSzzYnFu3EDP4PGdPBpp6gzlHIb9vr9Tbz1HuMixBCfVMWhAvmw==",
7
+ "publicKeyHash": "+9VwJrqieiPF2ZRB0xHFYhgQ6RYza5hfrVLpdB1KtKI=",
8
+ "transactionId": "f7f133694685bab2f44ae3a7b54e2c0d0d39a3bc73fa2e6b14a2baf628d6ce87"
9
+ }
10
+ }
@@ -11,9 +11,10 @@ class Gala::PaymentTokenTest < Minitest::Test
11
11
  @certificate = File.read(fixtures + "certificate.pem")
12
12
  @private_key = File.read(fixtures + "private_key.pem")
13
13
  @payment_token = Gala::PaymentToken.new(@token_attrs)
14
- @merchant_id = "F938F4658CA2C1C9C38B8DFCB5DBB2A2245607DDE2F114620E8468EF52D208CA"
15
- @shared_secret = Base64.decode64("a2pPfemSdA560FnzLSv8zfdlWdGJTonApOLq1zfgx8w=")
16
- @symmetric_key = Base64.decode64("HOSago9Z1DhhukQvzmgpuCGPuwq1W0AgasMQWNZvUIY=")
14
+ @merchant_id = "358DA5890B9555C0A9EFB84B5CD6FF04BFDCD5AABF5DC14B9872D8DF51EAF439"
15
+ @shared_secret = Base64.decode64("yCUzDuNYTnUnANZEdxC7+DvPmqNslB2YWYn68SBsJHU=")
16
+ @symmetric_key = Base64.decode64("3GTXJ4RuP/IhS23hsdOw2J2ecAZmC0RasbPIFdC3nQM=")
17
+
17
18
  end
18
19
 
19
20
  def test_initialize
@@ -40,16 +41,16 @@ class Gala::PaymentTokenTest < Minitest::Test
40
41
  end
41
42
 
42
43
  def test_decrypt
43
- payment_data = JSON.parse(@payment_token.decrypt(@certificate, @private_key))
44
- assert_equal "4109370251004320", payment_data["applicationPrimaryAccountNumber"]
45
- assert_equal "200731", payment_data["applicationExpirationDate"]
44
+ temp = @payment_token.decrypt(@certificate, @private_key)
45
+ payment_data = JSON.parse(temp)
46
+ assert_equal "5353756319181169", payment_data["applicationPrimaryAccountNumber"]
47
+ assert_equal "240930", payment_data["applicationExpirationDate"]
46
48
  assert_equal "840", payment_data["currencyCode"]
47
49
  assert_equal 100, payment_data["transactionAmount"]
48
50
  assert_nil payment_data["cardholderName"]
49
- assert_equal "040010030273", payment_data["deviceManufacturerIdentifier"]
51
+ assert_equal "050110030273", payment_data["deviceManufacturerIdentifier"]
50
52
  assert_equal "3DSecure", payment_data["paymentDataType"]
51
- assert_equal "Af9x/QwAA/DjmU65oyc1MAABAAA=", payment_data["paymentData"]["onlinePaymentCryptogram"]
52
- assert_equal "5", payment_data["paymentData"]["eciIndicator"]
53
+ assert_equal "AMwBRjPWDnAgAA7Rls7mAoABFA==", payment_data["paymentData"]["onlinePaymentCryptogram"]
53
54
  end
54
55
 
55
56
  def test_failed_decrypt
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gala
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Bennett
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-04 00:00:00.000000000 Z
12
+ date: 2023-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: aead
15
+ name: openssl
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: '1.8'
20
+ version: 3.1.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: '1.8'
27
+ version: 3.1.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -103,15 +103,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - ">="
105
105
  - !ruby/object:Gem::Version
106
- version: 1.8.7
106
+ version: 2.6.0
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.2.5
113
+ rubygems_version: 3.1.6
115
114
  signing_key:
116
115
  specification_version: 4
117
116
  summary: Apple Pay payment token decryption library