gala 0.3.2 → 0.4.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 +4 -4
- data/.circleci/config.yml +6 -14
- data/Gemfile +2 -2
- data/Gemfile.lock +5 -16
- data/README.md +12 -4
- data/gala.gemspec +3 -3
- data/lib/gala/payment_token.rb +21 -7
- data/lib/gala/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0d3e1fc4a6b470c17fd047d0976d3bb38313a66
|
4
|
+
data.tar.gz: 4f0ad1ff3596351cb1c5f01d4eff262fd92010ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 519d9de49800d7b2138bbf031c934dd39f00fb66ffa7e705ed8e37c2b939545ec2c6711c255441c92aedb48abb2942262662d223d9b1bad4542a5380d4c32906
|
7
|
+
data.tar.gz: aa05c2c3e4a959a0718496bee973d26a4c8461f1f3382c9e271acb3cb938ca4cf61b91058389aeea88e2d7dfd3ab9d3e1cc2d845d8cb998c1929170acbb51ddf
|
data/.circleci/config.yml
CHANGED
@@ -1,22 +1,15 @@
|
|
1
1
|
version: 2
|
2
2
|
jobs:
|
3
|
-
ruby-2.
|
3
|
+
ruby-2.4:
|
4
4
|
docker:
|
5
|
-
- image: circleci/ruby:2.
|
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.
|
10
|
+
ruby-2.5:
|
11
11
|
docker:
|
12
|
-
- image: circleci/ruby:2.
|
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.
|
29
|
-
- ruby-2.
|
30
|
-
- ruby-2.3
|
21
|
+
- ruby-2.4
|
22
|
+
- ruby-2.5
|
data/Gemfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
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.
|
13
|
-
|
4
|
+
gala (0.3.2)
|
5
|
+
openssl (~> 2.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
10
|
minitest (5.11.3)
|
21
|
-
|
22
|
-
|
11
|
+
openssl (2.1.0)
|
12
|
+
rake (12.3.1)
|
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.
|
24
|
+
1.16.1
|
data/README.md
CHANGED
@@ -4,20 +4,23 @@ Named after the [Gala apple](http://en.wikipedia.org/wiki/Gala_(apple)), Gala is
|
|
4
4
|
|
5
5
|
Gala is available under the MIT License.
|
6
6
|
|
7
|
+
## Ruby support
|
8
|
+
|
9
|
+
* 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.
|
10
|
+
* For Ruby >= 2.4, use the master branch or specify gala v0.4 and above
|
11
|
+
|
7
12
|
## Install
|
8
13
|
|
9
|
-
Add
|
14
|
+
Add `gala` to your `Gemfile`.
|
10
15
|
|
11
16
|
```ruby
|
12
|
-
gem "gala", "~> 0.
|
13
|
-
gem 'aead', git: 'https://github.com/Shopify/aead.git', ref: '340e7718d8bd9c1fcf3c443e32f439436ea2b70d'
|
17
|
+
gem "gala", "~> 0.4.0"
|
14
18
|
```
|
15
19
|
|
16
20
|
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
21
|
|
18
22
|
```ruby
|
19
23
|
gem "gala", git: "https://github.com/spreedly/gala.git", ref: :master
|
20
|
-
gem 'aead', git: 'https://github.com/Shopify/aead.git', ref: '340e7718d8bd9c1fcf3c443e32f439436ea2b70d'
|
21
24
|
```
|
22
25
|
|
23
26
|
Then `bundle install` to fetch Gala into your local environment.
|
@@ -91,6 +94,11 @@ $ rake release
|
|
91
94
|
|
92
95
|
## Changelog
|
93
96
|
|
97
|
+
### v0.4.0
|
98
|
+
|
99
|
+
* Remove unmaintained `aead` gem dependency
|
100
|
+
* Rely on Ruby 2.4 openssl support for aes-256-gcm ciphers (and specifying the initialization vector length).
|
101
|
+
|
94
102
|
### v0.3.2
|
95
103
|
|
96
104
|
* 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 = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.required_ruby_version =
|
22
|
+
spec.required_ruby_version = '>= 2.4.0'
|
23
23
|
|
24
|
-
spec.add_runtime_dependency '
|
24
|
+
spec.add_runtime_dependency 'openssl', '~> 2.0'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
27
27
|
spec.add_development_dependency 'rake', '~> 12.0'
|
data/lib/gala/payment_token.rb
CHANGED
@@ -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 =
|
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
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Bennett
|
@@ -12,19 +12,19 @@ cert_chain: []
|
|
12
12
|
date: 2018-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: openssl
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.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: '
|
27
|
+
version: '2.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
106
|
+
version: 2.4.0
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.6.11
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Apple Pay payment token decryption library
|