tpm-key_attestation 0.10.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28d7fefca9a69f2a4be0c8124bfb2721767c9c891768607473827c11df7aeaa3
4
- data.tar.gz: 4739a10cab12236ee54f4bfacd2a182bc2c48622c5feaffd800317d1ff49228d
3
+ metadata.gz: fe02507111938501d687c21a2a8461f086ca5ddd1b2d2f2715921a94ee249260
4
+ data.tar.gz: 3c7f0f3e79819bdd00e11febc517083320c40c8e4033c328654b64fe9eb88549
5
5
  SHA512:
6
- metadata.gz: b29f8eff516b2f8a8f78583b264586e9eec7c3ad31f8a351517e4b0552a39ef68be0274e83289189395a00e64aac171131252bd24c76fcd964e33a76acab436a
7
- data.tar.gz: 69a191891d4a12c8afd4b2acd07ec9c5728506fb33e94cd34e102de1d851acbcfd7694befb6daa01981ab0e2cfaf120a9ddcae4b2d1337eb0e9a74bee485bedd
6
+ metadata.gz: 0f77dbedcd721d3c06f6ec33a862f89c02360e913776a0c54847cf240b7af1d9ecde6b1bc1d2e1634b7342859bde36038a30aee8f1a85447a1afb494efd4506e
7
+ data.tar.gz: cac3351b83246f7c21f542a8c22043b99bdd73a7e218e25064f06785f173303f976aea9b2ffd13ac845e0f0155663543c74f3076f8c099b58db351ec4c823b0f
@@ -0,0 +1,49 @@
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.2'
20
+ - '3.1'
21
+ - '3.0'
22
+ - '2.7'
23
+ - '2.6'
24
+ - '2.5'
25
+ - '2.4'
26
+ gemfile:
27
+ - openssl_2_2
28
+ - openssl_2_1
29
+ - openssl_3_0
30
+ - openssl_3_1
31
+ exclude:
32
+ - ruby: '2.4'
33
+ gemfile: openssl_3_0
34
+ - ruby: '2.5'
35
+ gemfile: openssl_3_0
36
+ - ruby: '2.4'
37
+ gemfile: openssl_3_1
38
+ - ruby: '2.5'
39
+ gemfile: openssl_3_1
40
+ env:
41
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
42
+ steps:
43
+ - uses: actions/checkout@v2
44
+ - run: rm Gemfile.lock
45
+ - uses: ruby/setup-ruby@v1
46
+ with:
47
+ ruby-version: ${{ matrix.ruby }}
48
+ bundler-cache: true
49
+ - 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,10 @@ 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"
11
+ appraise "openssl_3_0" do
12
+ gem "openssl", "~> 3.0.0"
17
13
  end
18
14
 
19
- appraise "openssl_default" do
15
+ appraise "openssl_3_1" do
16
+ gem "openssl", "~> 3.1.0"
20
17
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.12.0] - 2022-07-05
4
+
5
+ - Loose OpenSSL dependency to support 3.2 users. Credits to @stanhu <3
6
+
7
+ ## [v0.11.0] - 2022-07-05
8
+
9
+ - Support OpenSSL ~>3.0.0. Credits to @ClearlyClaire <3
10
+
3
11
  ## [v0.10.0] - 2020-07-09
4
12
 
5
13
  ### Added
@@ -67,6 +75,8 @@ replacement of `JOSE` format `algorithm` string
67
75
  - `TPM::EKCertificate` wrapper
68
76
  - `TPM::SAttest` wrapper
69
77
 
78
+ [v0.12.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.11.0...v0.12.0/
79
+ [v0.11.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.10.0...v0.11.0/
70
80
  [v0.10.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.9.0...v0.10.0/
71
81
  [v0.9.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.8.0...v0.9.0/
72
82
  [v0.8.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.7.0...v0.8.0/
@@ -79,3 +89,4 @@ replacement of `JOSE` format `algorithm` string
79
89
  [v0.1.0]: https://github.com/cedarcode/tpm-key_attestation/compare/57c926ef7e83830cee8d111fdc5ccaf99ab2e861...v0.1.0/
80
90
 
81
91
  [@santiagorodriguez96]: https://github.com/santiagorodriguez96
92
+ [@ClearlyClaire]: https://github.com/ClearlyClaire
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tpm-key_attestation (0.10.0)
4
+ tpm-key_attestation (0.11.0)
5
5
  bindata (~> 2.4)
6
+ openssl (> 2.0)
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.14)
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.1.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: "../"
@@ -7,5 +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", "~> 3.1.0"
10
11
 
11
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.12.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"
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.12.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: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -24,6 +24,20 @@ 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
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: openssl-signature_algorithm
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,16 +52,16 @@ dependencies:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.0'
41
- description:
42
- email:
55
+ description:
56
+ email:
43
57
  executables: []
44
58
  extensions: []
45
59
  extra_rdoc_files: []
46
60
  files:
61
+ - ".github/workflows/build.yml"
47
62
  - ".gitignore"
48
63
  - ".rspec"
49
64
  - ".rubocop.yml"
50
- - ".travis.yml"
51
65
  - Appraisals
52
66
  - CHANGELOG.md
53
67
  - Gemfile
@@ -58,20 +72,16 @@ files:
58
72
  - SECURITY.md
59
73
  - bin/console
60
74
  - bin/setup
61
- - gemfiles/openssl_2_0.gemfile
62
75
  - gemfiles/openssl_2_1.gemfile
63
76
  - gemfiles/openssl_2_2.gemfile
64
- - gemfiles/openssl_default.gemfile
65
- - gemfiles/openssl_head.gemfile
66
- - install-openssl.sh
67
- - install-ruby.sh
77
+ - gemfiles/openssl_3_0.gemfile
78
+ - gemfiles/openssl_3_1.gemfile
68
79
  - lib/tpm/aik_certificate.rb
69
80
  - lib/tpm/certificates/AMD/RootCA/AMD-fTPM-ECC-RootCA.crt
70
81
  - lib/tpm/certificates/AMD/RootCA/AMD-fTPM-RSA-RootCA.crt
71
82
  - lib/tpm/certificates/Atmel/RootCA/Atmel TPM Root Signing Module.der
72
83
  - lib/tpm/certificates/Infineon/RootCA/IFX TPM EK Root CA.cer
73
84
  - lib/tpm/certificates/Infineon/RootCA/IFX-RootCA.cer
74
- - lib/tpm/certificates/Infineon/RootCA/IFX_TPM_RootCert_008.crt
75
85
  - lib/tpm/certificates/Infineon/RootCA/Infineon OPTIGA(TM) ECC Root CA.crt
76
86
  - lib/tpm/certificates/Infineon/RootCA/Infineon OPTIGA(TM) RSA Root CA.crt
77
87
  - lib/tpm/certificates/Intel/RootCA/EKRootPublicKey.cer
@@ -88,7 +98,6 @@ files:
88
98
  - lib/tpm/certificates/Nuvoton/RootCA/Nuvoton TPM Root CA 2011.cer
89
99
  - lib/tpm/certificates/Nuvoton/RootCA/Nuvoton TPM Root CA 2110.cer
90
100
  - 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
101
  - lib/tpm/certificates/STMicro/RootCA/GlobalSign Trusted Computing CA.crt
93
102
  - lib/tpm/certificates/STMicro/RootCA/GlobalSign Trusted Platform Module ECC Root
94
103
  CA.crt
@@ -115,7 +124,7 @@ metadata:
115
124
  homepage_uri: https://github.com/cedarcode/tpm-key_attestation
116
125
  source_code_uri: https://github.com/cedarcode/tpm-key_attestation
117
126
  changelog_uri: https://github.com/cedarcode/tpm-key_attestation/blob/master/CHANGELOG.md
118
- post_install_message:
127
+ post_install_message:
119
128
  rdoc_options: []
120
129
  require_paths:
121
130
  - lib
@@ -130,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
139
  - !ruby/object:Gem::Version
131
140
  version: '0'
132
141
  requirements: []
133
- rubygems_version: 3.1.4
134
- signing_key:
142
+ rubygems_version: 3.2.32
143
+ signing_key:
135
144
  specification_version: 4
136
145
  summary: TPM Key Attestation verifier
137
146
  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,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'