pedicel 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pedicel/base.rb +10 -19
- data/lib/pedicel/validator.rb +11 -1
- data/lib/pedicel/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 004d5f107ed691aa9edd17fc47ab18dc9c795e67b911cf5667ccd73708b7381e
|
4
|
+
data.tar.gz: 1c42781d776de29f26364109556cfb0836fa10b42b54374675330b941ecf0298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d4cc8d8715e4c06d8eeb5ef4b90205a450ed8bd7c8b697faf4cd5a2742f747faab2f064e5b774846b388800b1b42e82f5ce44e6e84b22ee3c1a1c85fd43e19d
|
7
|
+
data.tar.gz: 312c53ec2fdd15ec88431634c34b521302e83ab12d4e2ca24f6feb38f4c84f67d4dc75912f58770f654b40212d10dc4e62db943112e5b675dfd247c212be1417
|
data/lib/pedicel/base.rb
CHANGED
@@ -196,30 +196,21 @@ module Pedicel
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def self.verify_x509_chain(root:, intermediate:, leaf:)
|
199
|
-
|
199
|
+
# Specifically, ensure that the signature was created using the private
|
200
|
+
# key corresponding to the leaf certificate, that the leaf certificate is
|
201
|
+
# signed by the intermediate CA, and that the intermediate CA is signed by
|
202
|
+
# the Apple Root CA - G3.
|
200
203
|
|
201
|
-
unless
|
202
|
-
raise SignatureError,
|
204
|
+
unless root.verify(root.public_key)
|
205
|
+
raise SignatureError, 'invalid chain due to root'
|
203
206
|
end
|
204
207
|
|
205
|
-
unless
|
206
|
-
raise SignatureError,
|
208
|
+
unless intermediate.verify(root.public_key)
|
209
|
+
raise SignatureError, 'invalid chain due to intermediate'
|
207
210
|
end
|
208
211
|
|
209
|
-
|
210
|
-
|
211
|
-
rescue OpenSSL::X509::StoreError
|
212
|
-
raise SignatureError, "invalid chain due to intermediate"
|
213
|
-
end
|
214
|
-
|
215
|
-
begin
|
216
|
-
store.add_cert(leaf)
|
217
|
-
rescue OpenSSL::X509::StoreError
|
218
|
-
raise SignatureError, "invalid chain due to leaf"
|
219
|
-
end
|
220
|
-
|
221
|
-
unless store.verify(leaf)
|
222
|
-
raise SignatureError, "invalid chain due to leaf: #{store.error_string}"
|
212
|
+
unless leaf.verify(intermediate.public_key)
|
213
|
+
raise SignatureError, 'invalid chain due to leaf'
|
223
214
|
end
|
224
215
|
|
225
216
|
true
|
data/lib/pedicel/validator.rb
CHANGED
@@ -50,7 +50,7 @@ module Pedicel
|
|
50
50
|
|
51
51
|
predicate(:yymmdd?) { |x| str?(x) && match_b.(x, /\A\d{6}\z/) }
|
52
52
|
|
53
|
-
predicate(:eci?) { |x| str?(x) && match_b.(x, /\A\d{2}\z/) }
|
53
|
+
predicate(:eci?) { |x| str?(x) && match_b.(x, /\A\d{1,2}\z/) }
|
54
54
|
|
55
55
|
predicate(:ec_public_key?) { |x| base64?(x) && OpenSSL::PKey::EC.new(Base64.decode64(x)).check_key rescue false }
|
56
56
|
|
@@ -168,6 +168,16 @@ module Pedicel
|
|
168
168
|
|
169
169
|
@validation.errors
|
170
170
|
end
|
171
|
+
|
172
|
+
def errors_formatted(node = [errors])
|
173
|
+
node.pop.flat_map do |key, value|
|
174
|
+
if value.is_a?(Array)
|
175
|
+
value.map { |error| "#{(node + [key]).join('.')} #{error}" }
|
176
|
+
else
|
177
|
+
errors_formatted(node + [key, value])
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
171
181
|
end
|
172
182
|
|
173
183
|
class Token
|
data/lib/pedicel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pedicel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clearhaus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06
|
11
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-validation
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.7.
|
115
|
+
rubygems_version: 2.7.7
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Decryption of Apple Pay payment tokens
|