tpm-key_attestation 0.10.0 → 0.11.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: 28d7fefca9a69f2a4be0c8124bfb2721767c9c891768607473827c11df7aeaa3
4
- data.tar.gz: 4739a10cab12236ee54f4bfacd2a182bc2c48622c5feaffd800317d1ff49228d
3
+ metadata.gz: 119c14ff3ec3d663dcd7557406f4d147d8e010e61705f759cd2cba7412045458
4
+ data.tar.gz: a0aae7f5759575312ca4050e94622cfcf5c24719450ba399115061df45b0ae72
5
5
  SHA512:
6
- metadata.gz: b29f8eff516b2f8a8f78583b264586e9eec7c3ad31f8a351517e4b0552a39ef68be0274e83289189395a00e64aac171131252bd24c76fcd964e33a76acab436a
7
- data.tar.gz: 69a191891d4a12c8afd4b2acd07ec9c5728506fb33e94cd34e102de1d851acbcfd7694befb6daa01981ab0e2cfaf120a9ddcae4b2d1337eb0e9a74bee485bedd
6
+ metadata.gz: 92d66d626a3849915ef0379cbe150363a7072e7f74e8988b93273cc0ce0ad0f5093e7a69b2ad80929de319dd682b33f6ef09dfba427b8bb83c56deed08ae08ea
7
+ data.tar.gz: 9ca765e75668c4c9f400acfadabeb8c59bb89b5719adb59e926d8ce25e037efd9a3a05069fa3dfc2aa21559499c177f925fe5d67c1bbeea9ea6ebbc79ec90667
@@ -0,0 +1,42 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: build
9
+
10
+ on: push
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-20.04
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby:
19
+ - '3.0'
20
+ - '2.7'
21
+ - '2.6'
22
+ - '2.5'
23
+ - '2.4'
24
+ gemfile:
25
+ - openssl_2_2
26
+ - openssl_2_1
27
+ - openssl_3_0
28
+ exclude:
29
+ - ruby: '2.4'
30
+ gemfile: openssl_3_0
31
+ - ruby: '2.5'
32
+ gemfile: openssl_3_0
33
+ env:
34
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+ - run: rm Gemfile.lock
38
+ - uses: ruby/setup-ruby@v1
39
+ with:
40
+ ruby-version: ${{ matrix.ruby }}
41
+ bundler-cache: true
42
+ - run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ AllCops:
3
3
  DisabledByDefault: true
4
4
  Exclude:
5
5
  - "gemfiles/**/*"
6
+ - "vendor/bundle/**/*"
6
7
 
7
8
  Bundler:
8
9
  Enabled: true
data/Appraisals CHANGED
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "openssl_head" do
4
- gem "openssl", git: "https://github.com/ruby/openssl"
5
- end
6
-
7
3
  appraise "openssl_2_2" do
8
4
  gem "openssl", "~> 2.2.0"
9
5
  end
@@ -12,9 +8,6 @@ appraise "openssl_2_1" do
12
8
  gem "openssl", "~> 2.1.0"
13
9
  end
14
10
 
15
- appraise "openssl_2_0" do
16
- gem "openssl", "~> 2.0.0"
17
- end
18
-
19
- appraise "openssl_default" do
11
+ appraise "openssl_3_0" do
12
+ gem "openssl", "~> 3.0.0"
20
13
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.11.0] - 2022-07-05
4
+
5
+ - Support OpenSSL ~>3.0.0. Credits to @ClearlyClaire <3
6
+
3
7
  ## [v0.10.0] - 2020-07-09
4
8
 
5
9
  ### Added
@@ -67,6 +71,7 @@ replacement of `JOSE` format `algorithm` string
67
71
  - `TPM::EKCertificate` wrapper
68
72
  - `TPM::SAttest` wrapper
69
73
 
74
+ [v0.11.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.10.0...v0.11.0/
70
75
  [v0.10.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.9.0...v0.10.0/
71
76
  [v0.9.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.8.0...v0.9.0/
72
77
  [v0.8.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.7.0...v0.8.0/
@@ -79,3 +84,4 @@ replacement of `JOSE` format `algorithm` string
79
84
  [v0.1.0]: https://github.com/cedarcode/tpm-key_attestation/compare/57c926ef7e83830cee8d111fdc5ccaf99ab2e861...v0.1.0/
80
85
 
81
86
  [@santiagorodriguez96]: https://github.com/santiagorodriguez96
87
+ [@ClearlyClaire]: https://github.com/ClearlyClaire
data/Gemfile.lock CHANGED
@@ -3,6 +3,7 @@ PATH
3
3
  specs:
4
4
  tpm-key_attestation (0.10.0)
5
5
  bindata (~> 2.4)
6
+ openssl (> 2.0, < 3.1)
6
7
  openssl-signature_algorithm (~> 1.0)
7
8
 
8
9
  GEM
@@ -12,31 +13,33 @@ GEM
12
13
  bundler
13
14
  rake
14
15
  thor (>= 0.14.0)
15
- ast (2.4.1)
16
- bindata (2.4.7)
16
+ ast (2.4.2)
17
+ bindata (2.4.8)
17
18
  byebug (11.1.3)
18
19
  diff-lcs (1.4.4)
19
20
  jaro_winkler (1.5.4)
20
- openssl-signature_algorithm (1.0.0)
21
- parallel (1.19.2)
22
- parser (2.7.1.4)
21
+ openssl (3.0.0)
22
+ openssl-signature_algorithm (1.2.1)
23
+ openssl (> 2.0, < 3.1)
24
+ parallel (1.20.1)
25
+ parser (3.0.0.0)
23
26
  ast (~> 2.4.1)
24
27
  rainbow (3.0.0)
25
- rake (13.0.1)
28
+ rake (13.0.3)
26
29
  rexml (3.2.4)
27
- rspec (3.9.0)
28
- rspec-core (~> 3.9.0)
29
- rspec-expectations (~> 3.9.0)
30
- rspec-mocks (~> 3.9.0)
31
- rspec-core (3.9.2)
32
- rspec-support (~> 3.9.3)
33
- rspec-expectations (3.9.2)
30
+ rspec (3.10.0)
31
+ rspec-core (~> 3.10.0)
32
+ rspec-expectations (~> 3.10.0)
33
+ rspec-mocks (~> 3.10.0)
34
+ rspec-core (3.10.1)
35
+ rspec-support (~> 3.10.0)
36
+ rspec-expectations (3.10.1)
34
37
  diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.9.0)
36
- rspec-mocks (3.9.1)
38
+ rspec-support (~> 3.10.0)
39
+ rspec-mocks (3.10.2)
37
40
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.9.0)
39
- rspec-support (3.9.3)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-support (3.10.2)
40
43
  rubocop (0.80.1)
41
44
  jaro_winkler (~> 1.5.1)
42
45
  parallel (~> 1.10)
@@ -45,8 +48,8 @@ GEM
45
48
  rexml
46
49
  ruby-progressbar (~> 1.7)
47
50
  unicode-display_width (>= 1.4.0, < 1.7)
48
- ruby-progressbar (1.10.1)
49
- thor (1.0.1)
51
+ ruby-progressbar (1.11.0)
52
+ thor (1.1.0)
50
53
  unicode-display_width (1.6.1)
51
54
 
52
55
  PLATFORMS
@@ -61,4 +64,4 @@ DEPENDENCIES
61
64
  tpm-key_attestation!
62
65
 
63
66
  BUNDLED WITH
64
- 2.1.4
67
+ 2.2.8
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  TPM Key Attestation utitlies
4
4
 
5
5
  [![Gem](https://img.shields.io/gem/v/tpm-key_attestation.svg?style=flat-square&color=informational)](https://rubygems.org/gems/tpm-key_attestation)
6
- [![Travis](https://img.shields.io/travis/cedarcode/tpm-key_attestation/master.svg?style=flat-square)](https://travis-ci.org/cedarcode/tpm-key_attestation)
6
+ [![Actions Build](https://github.com/cedarcode/tpm-key_attestation/workflows/build/badge.svg)](https://github.com/cedarcode/tpm-key_attestation/actions)
7
7
  [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-informational.svg?style=flat-square)](https://conventionalcommits.org)
8
8
 
9
9
  ## Installation
@@ -7,6 +7,6 @@ gem "byebug", "~> 11.0"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "rspec", "~> 3.0"
9
9
  gem "rubocop", "~> 0.80.1"
10
- gem "openssl", "~> 2.0.0"
10
+ gem "openssl", "~> 3.0.0"
11
11
 
12
12
  gemspec path: "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TPM
4
4
  class KeyAttestation
5
- VERSION = "0.10.0"
5
+ VERSION = "0.11.0"
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ require "tpm/public_area"
11
11
  module TPM
12
12
  class KeyAttestation
13
13
  # https://docs.microsoft.com/en-us/windows-server/security/guarded-fabric-shielded-vm/guarded-fabric-install-trusted-tpm-root-certificates
14
- ROOT_CERTIFICATES =
14
+ TRUSTED_CERTIFICATES =
15
15
  begin
16
16
  pattern = File.expand_path(File.join(__dir__, "certificates", "*", "RootCA", "*.*"))
17
17
  Dir.glob(pattern).map do |filename|
@@ -29,7 +29,7 @@ module TPM
29
29
  :signature_algorithm,
30
30
  :hash_algorithm,
31
31
  :qualifying_data,
32
- :root_certificates
32
+ :trusted_certificates
33
33
  )
34
34
 
35
35
  def initialize(
@@ -40,7 +40,7 @@ module TPM
40
40
  qualifying_data,
41
41
  signature_algorithm: ALG_RSASSA,
42
42
  hash_algorithm: ALG_SHA256,
43
- root_certificates: ROOT_CERTIFICATES
43
+ trusted_certificates: TRUSTED_CERTIFICATES
44
44
  )
45
45
  @certify_info = certify_info
46
46
  @signature = signature
@@ -50,7 +50,7 @@ module TPM
50
50
  @signature_algorithm = signature_algorithm
51
51
  @hash_algorithm = hash_algorithm
52
52
  @qualifying_data = qualifying_data
53
- @root_certificates = root_certificates
53
+ @trusted_certificates = trusted_certificates
54
54
  end
55
55
 
56
56
  def key
@@ -88,7 +88,7 @@ module TPM
88
88
  def trust_store
89
89
  @trust_store ||=
90
90
  OpenSSL::X509::Store.new.tap do |trust_store|
91
- root_certificates.uniq(&:serial).each { |root_certificate| trust_store.add_cert(root_certificate) }
91
+ trusted_certificates.uniq(&:serial).each { |trusted_certificate| trust_store.add_cert(trusted_certificate) }
92
92
  end
93
93
  end
94
94
 
data/lib/tpm/t_public.rb CHANGED
@@ -77,11 +77,22 @@ module TPM
77
77
  def ecc_key
78
78
  if parameters.scheme == TPM::ALG_ECDSA
79
79
  group = OpenSSL::PKey::EC::Group.new(openssl_curve_name)
80
-
81
- key = OpenSSL::PKey::EC.new(group)
82
- key.public_key = OpenSSL::PKey::EC::Point.new(group, bn(ECC_UNCOMPRESSED_POINT_INDICATOR + unique.buffer.value))
83
-
84
- key
80
+ point = OpenSSL::PKey::EC::Point.new(group, bn(ECC_UNCOMPRESSED_POINT_INDICATOR + unique.buffer.value))
81
+
82
+ # RFC5480 SubjectPublicKeyInfo
83
+ asn1 = OpenSSL::ASN1::Sequence(
84
+ [
85
+ OpenSSL::ASN1::Sequence(
86
+ [
87
+ OpenSSL::ASN1::ObjectId("id-ecPublicKey"),
88
+ OpenSSL::ASN1::ObjectId(group.curve_name),
89
+ ]
90
+ ),
91
+ OpenSSL::ASN1::BitString(point.to_octet_string(:uncompressed))
92
+ ]
93
+ )
94
+
95
+ OpenSSL::PKey::EC.new(asn1.to_der)
85
96
  end
86
97
  end
87
98
 
@@ -91,10 +102,15 @@ module TPM
91
102
  n = unique.buffer.value
92
103
 
93
104
  if parameters.key_bits / BYTE_LENGTH == n.size
94
- key = OpenSSL::PKey::RSA.new(parameters.key_bits.value)
95
- key.set_key(bn(n), bn(RSA_KEY_DEFAULT_PUBLIC_EXPONENT), nil)
96
-
97
- key.public_key
105
+ # PKCS#1 RSAPublicKey
106
+ asn1 = OpenSSL::ASN1::Sequence(
107
+ [
108
+ OpenSSL::ASN1::Integer.new(bn(n)),
109
+ OpenSSL::ASN1::Integer.new(bn(RSA_KEY_DEFAULT_PUBLIC_EXPONENT)),
110
+ ]
111
+ )
112
+
113
+ OpenSSL::PKey::RSA.new(asn1.to_der)
98
114
  end
99
115
  end
100
116
  end
@@ -26,5 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
  spec.add_dependency "bindata", "~> 2.4"
29
+ spec.add_dependency "openssl", "> 2.0", "< 3.1"
29
30
  spec.add_dependency "openssl-signature_algorithm", "~> 1.0"
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tpm-key_attestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gonzalo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-09 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: openssl
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3.1'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.1'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: openssl-signature_algorithm
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -38,16 +58,16 @@ dependencies:
38
58
  - - "~>"
39
59
  - !ruby/object:Gem::Version
40
60
  version: '1.0'
41
- description:
42
- email:
61
+ description:
62
+ email:
43
63
  executables: []
44
64
  extensions: []
45
65
  extra_rdoc_files: []
46
66
  files:
67
+ - ".github/workflows/build.yml"
47
68
  - ".gitignore"
48
69
  - ".rspec"
49
70
  - ".rubocop.yml"
50
- - ".travis.yml"
51
71
  - Appraisals
52
72
  - CHANGELOG.md
53
73
  - Gemfile
@@ -58,20 +78,15 @@ files:
58
78
  - SECURITY.md
59
79
  - bin/console
60
80
  - bin/setup
61
- - gemfiles/openssl_2_0.gemfile
62
81
  - gemfiles/openssl_2_1.gemfile
63
82
  - gemfiles/openssl_2_2.gemfile
64
- - gemfiles/openssl_default.gemfile
65
- - gemfiles/openssl_head.gemfile
66
- - install-openssl.sh
67
- - install-ruby.sh
83
+ - gemfiles/openssl_3_0.gemfile
68
84
  - lib/tpm/aik_certificate.rb
69
85
  - lib/tpm/certificates/AMD/RootCA/AMD-fTPM-ECC-RootCA.crt
70
86
  - lib/tpm/certificates/AMD/RootCA/AMD-fTPM-RSA-RootCA.crt
71
87
  - lib/tpm/certificates/Atmel/RootCA/Atmel TPM Root Signing Module.der
72
88
  - lib/tpm/certificates/Infineon/RootCA/IFX TPM EK Root CA.cer
73
89
  - lib/tpm/certificates/Infineon/RootCA/IFX-RootCA.cer
74
- - lib/tpm/certificates/Infineon/RootCA/IFX_TPM_RootCert_008.crt
75
90
  - lib/tpm/certificates/Infineon/RootCA/Infineon OPTIGA(TM) ECC Root CA.crt
76
91
  - lib/tpm/certificates/Infineon/RootCA/Infineon OPTIGA(TM) RSA Root CA.crt
77
92
  - lib/tpm/certificates/Intel/RootCA/EKRootPublicKey.cer
@@ -88,7 +103,6 @@ files:
88
103
  - lib/tpm/certificates/Nuvoton/RootCA/Nuvoton TPM Root CA 2011.cer
89
104
  - lib/tpm/certificates/Nuvoton/RootCA/Nuvoton TPM Root CA 2110.cer
90
105
  - lib/tpm/certificates/Nuvoton/RootCA/Nuvoton TPM Root CA 2111.cer
91
- - lib/tpm/certificates/QC/RootCA/Microsoft TPM Root Certificate Authority 2014.cer
92
106
  - lib/tpm/certificates/STMicro/RootCA/GlobalSign Trusted Computing CA.crt
93
107
  - lib/tpm/certificates/STMicro/RootCA/GlobalSign Trusted Platform Module ECC Root
94
108
  CA.crt
@@ -115,7 +129,7 @@ metadata:
115
129
  homepage_uri: https://github.com/cedarcode/tpm-key_attestation
116
130
  source_code_uri: https://github.com/cedarcode/tpm-key_attestation
117
131
  changelog_uri: https://github.com/cedarcode/tpm-key_attestation/blob/master/CHANGELOG.md
118
- post_install_message:
132
+ post_install_message:
119
133
  rdoc_options: []
120
134
  require_paths:
121
135
  - lib
@@ -130,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  requirements: []
133
- rubygems_version: 3.1.4
134
- signing_key:
147
+ rubygems_version: 3.2.32
148
+ signing_key:
135
149
  specification_version: 4
136
150
  summary: TPM Key Attestation verifier
137
151
  test_files: []
data/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- ---
2
- dist: bionic
3
- language: ruby
4
-
5
- cache:
6
- bundler: true
7
- directories:
8
- - /home/travis/.rvm/
9
-
10
- env:
11
- - RB=2.7.1 LIBSSL=1.0
12
- - RB=2.7.1 LIBSSL=1.1
13
- - RB=2.6.6 LIBSSL=1.0
14
- - RB=2.6.6 LIBSSL=1.1
15
- - RB=2.5.8 LIBSSL=1.0
16
- - RB=2.5.8 LIBSSL=1.1
17
- - RB=2.4.10 LIBSSL=1.0
18
- - RB=2.4.10 LIBSSL=1.1
19
- - RB=ruby-head LIBSSL=1.0
20
- - RB=ruby-head LIBSSL=1.1
21
-
22
- gemfile:
23
- - gemfiles/openssl_head.gemfile
24
- - gemfiles/openssl_2_2.gemfile
25
- - gemfiles/openssl_2_1.gemfile
26
- - gemfiles/openssl_2_0.gemfile
27
- - gemfiles/openssl_default.gemfile
28
-
29
- matrix:
30
- fast_finish: true
31
- allow_failures:
32
- - env: RB=ruby-head LIBSSL=1.0
33
- - env: RB=ruby-head LIBSSL=1.1
34
- - gemfile: gemfiles/openssl_head.gemfile
35
-
36
- before_install:
37
- - ./install-openssl.sh
38
- - ./install-ruby.sh
39
- - gem install bundler -v "~> 2.0"
40
- - rm Gemfile.lock
@@ -1,11 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal", "~> 2.2.0"
6
- gem "byebug", "~> 11.0"
7
- gem "rake", "~> 13.0"
8
- gem "rspec", "~> 3.0"
9
- gem "rubocop", "~> 0.80.1"
10
-
11
- gemspec path: "../"
@@ -1,12 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal", "~> 2.2.0"
6
- gem "byebug", "~> 11.0"
7
- gem "rake", "~> 13.0"
8
- gem "rspec", "~> 3.0"
9
- gem "rubocop", "~> 0.80.1"
10
- gem "openssl", git: "https://github.com/ruby/openssl"
11
-
12
- gemspec path: "../"
data/install-openssl.sh DELETED
@@ -1,3 +0,0 @@
1
- if [[ "${LIBSSL}" == "1.0" ]]; then
2
- sudo apt purge libssl-dev && sudo apt-get -yq --no-install-suggests --no-install-recommends install libssl1.0-dev
3
- fi
data/install-ruby.sh DELETED
@@ -1,10 +0,0 @@
1
- source ~/.rvm/scripts/rvm
2
-
3
- if [[ "${LIBSSL}" == "1.0" ]]; then
4
- rvm install $RB --autolibs=read-only -C --with-openssl-dir=usr/include/openssl
5
- elif [[ "${LIBSSL}" == "1.1" ]]; then
6
- rvm install $RB --binary --fuzzy
7
- fi
8
-
9
- rvm use $RB
10
- ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'