android_key_attestation 0.2.0 → 0.3.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
2
  SHA256:
3
- metadata.gz: 4e3bb936ba3e6e271423c4a56a8e07450a097161d3ad4c9f7a38615d9206814c
4
- data.tar.gz: 3e64a79f6258523de7b6a6c4cc357c16904425dfc95d74a2e4269e8655395d60
3
+ metadata.gz: 80a822b17938c94650c9a22a6aa11f984774ceb095fa2f21907dffe635471f9d
4
+ data.tar.gz: 00b086c968d927e5e1c71639922255bd3e664120e8246a2be7998a28b72b17ed
5
5
  SHA512:
6
- metadata.gz: 561e7a64bcd9d164368ca967214fc3d777bc3ebce59e53f650d6e44b9b68c3ae5707aecc99e1c2b03b425e0c0ad669f8ccf8f5321d3472b0b6966b6b3ee3559e
7
- data.tar.gz: da3cff8a1cfdfa7ff3a4331e6261cb460dba73271f31fbd0295e3599e24572ea4b1887b8d0f6dd8c255f0b0d9731adf6f97009bcf1adbba4107be3b15d2d38bd
6
+ metadata.gz: fb59d0fcba2c3c65b73a9e3500e812e7229acb9dc56a75bc981258b70c62c215215f21a6382ac31452bf5c8fdf0cabdf9aa17204ba0015280466638245d40423
7
+ data.tar.gz: 7c588c47e006d3270de6c5ebca545b9bb8468ed4974d88d4c45cc5ddd756752655c6017118ef9feebf76358fff0733ce784b431629f861466a3df6471c57907b
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [Unreleased]
8
+
9
+ ## [0.3.0] - 2020-02-16
10
+ ### Added
11
+ - `Statement#verify_certificate_chain` to verify if the attestation certificate is trustworthy
12
+
7
13
  ## [0.2.0] - 2019-12-31
8
14
  ### Changed
9
15
  - Raise `ChallengeMismatchError` if the challenge lengths are different, not `ArgumentError`
@@ -12,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
18
  ### Added
13
19
  - Extracted from [webauthn-ruby](https://github.com/cedarcode/webauthn-ruby) after discussion with the maintainers. Thanks for the feedback @grzuy and @brauliomartinezlm!
14
20
 
15
- [Unreleased]: https://github.com/bdewater/android_key_attestation/compare/v0.1.0...HEAD
16
- [0.1.0]: https://github.com/bdewater/android_key_attestation/releases/tag/v0.1.0...0.2.0
21
+ [Unreleased]: https://github.com/bdewater/android_key_attestation/compare/v0.3.0...HEAD
22
+ [0.3.0]: https://github.com/bdewater/android_key_attestation/compare/v0.2.0...v0.3.0
23
+ [0.2.0]: https://github.com/bdewater/android_key_attestation/compare/v0.1.0...v0.2.0
17
24
  [0.1.0]: https://github.com/bdewater/android_key_attestation/releases/tag/v0.1.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- android_key_attestation (0.2.0)
4
+ android_key_attestation (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,6 +4,9 @@ module AndroidKeyAttestation
4
4
  class Error < StandardError; end
5
5
  class ExtensionMissingError < Error; end
6
6
  class ChallengeMismatchError < Error; end
7
+ class CertificateVerificationError < Error; end
8
+
9
+ GEM_ROOT = File.expand_path(__dir__)
7
10
  end
8
11
 
9
12
  require_relative "android_key_attestation/statement"
@@ -0,0 +1,31 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFYDCCA0igAwIBAgIJAOj6GWMU0voYMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
3
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTYwNTI2MTYyODUyWhcNMjYwNTI0MTYy
4
+ ODUyWjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
5
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
6
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXn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HOjpvAy5Y3m00m
22
+ qC0w/Zwvju1twb4vhLaJ5NkUJYsUS7rmJKHHBnETLi8GFqiEsqTWpG/6ibYCv7rY
23
+ DBJDcR9W62BW9jfIoBQcxUCUJouMPH25lLNcDc1ssqvC2v7iUgI9LeoM1sNovqPm
24
+ QUiG9rHli1vXxzCyaMTjwftkJLkf6724DFhuKug2jITV0QkXvaJWF4nUaHOTNA4u
25
+ JU9WDvZLI1j83A+/xnAJUucIv/zGJ1AMH2boHqF8CY16LpsYgBt6tKxxWH00XcyD
26
+ CdW2KlBCeqbQPcsFmWyWugxdcekhYsAWyoSf818NUsZdBWBaR/OukXrNLfkQ79Iy
27
+ ZohZbvabO/X+MVT3rriAoKc8oE2Uws6DF+60PV7/WIPjNvXySdqspImSN78mflxD
28
+ qwLqRBYkA3I75qppLGG9rp7UCdRjxMl8ZDBld+7yvHVgt1cVzJx9xnyGCC23Uaic
29
+ MDSXYrB4I4WHXPGjxhZuCuPBLTdOLU8YRvMYdEvYebWHMpvwGCF6bAx3JBpIeOQ1
30
+ wDB5y0USicV3YgYGmi+NZfhA4URSh77Yd6uuJOJENRaNVTzk
31
+ -----END CERTIFICATE-----
@@ -8,6 +8,10 @@ require_relative "fixed_length_secure_compare"
8
8
  module AndroidKeyAttestation
9
9
  class Statement
10
10
  EXTENSION_DATA_OID = "1.3.6.1.4.1.11129.2.1.17"
11
+ GOOGLE_ROOT_CERTIFICATES = begin
12
+ file = File.read(File.join(GEM_ROOT, "android_key_attestation", "google_hardware_attestation_root.pem"))
13
+ [OpenSSL::X509::Certificate.new(file)]
14
+ end.freeze
11
15
 
12
16
  extend Forwardable
13
17
  def_delegators :key_description, :attestation_version, :attestation_security_level, :keymaster_version,
@@ -30,6 +34,15 @@ module AndroidKeyAttestation
30
34
  raise(ChallengeMismatchError)
31
35
  end
32
36
 
37
+ def verify_certificate_chain(root_certificates: GOOGLE_ROOT_CERTIFICATES, time: Time.now)
38
+ store = OpenSSL::X509::Store.new
39
+ root_certificates.each { |cert| store.add_cert(cert) }
40
+ store.time = time
41
+
42
+ store.verify(attestation_certificate, @certificates[1..-1]) ||
43
+ raise(CertificateVerificationError, store.error_string)
44
+ end
45
+
33
46
  def key_description
34
47
  @key_description ||= begin
35
48
  extension_data = attestation_certificate.extensions.detect { |ext| ext.oid == EXTENSION_DATA_OID }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AndroidKeyAttestation
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: android_key_attestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart de Water
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-31 00:00:00.000000000 Z
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,6 +90,7 @@ files:
90
90
  - lib/android_key_attestation.rb
91
91
  - lib/android_key_attestation/authorization_list.rb
92
92
  - lib/android_key_attestation/fixed_length_secure_compare.rb
93
+ - lib/android_key_attestation/google_hardware_attestation_root.pem
93
94
  - lib/android_key_attestation/key_description.rb
94
95
  - lib/android_key_attestation/statement.rb
95
96
  - lib/android_key_attestation/version.rb
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  - !ruby/object:Gem::Version
116
117
  version: '0'
117
118
  requirements: []
118
- rubygems_version: 3.1.2
119
+ rubygems_version: 3.0.3
119
120
  signing_key:
120
121
  specification_version: 4
121
122
  summary: Android key attestation verification