tpm-key_attestation 0.9.0 → 0.12.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: 0f495569765faf3eaf8bcd9ff004405e278d720d12253ec01f98175f9dce3e4c
4
- data.tar.gz: 26105eb6528b31ddec9a800cdeddea4eee311e25fdfc1c99cee2345b43e58bd9
3
+ metadata.gz: fe02507111938501d687c21a2a8461f086ca5ddd1b2d2f2715921a94ee249260
4
+ data.tar.gz: 3c7f0f3e79819bdd00e11febc517083320c40c8e4033c328654b64fe9eb88549
5
5
  SHA512:
6
- metadata.gz: 3501ffabdfea8bc28803a2036f0e83d2e16eb7cdcd21a937f9112ffd7ecfdb91ff37290fd97b5d8de50eab22f3ddf109899b7f715c90b4ef667a0aed04156c4b
7
- data.tar.gz: 26698f67fad4bcb5788d5f01ab536057b3fa3c0bd2db5338aa495dda45435bf528e101ae91e4afddd3f94b8389456544677a9964871df9f7997b79274ca41f38
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,19 @@
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
+
11
+ ## [v0.10.0] - 2020-07-09
12
+
13
+ ### Added
14
+
15
+ - Support ECDSA with NIST P384 and P521 curves
16
+
3
17
  ## [v0.9.0] - 2020-05-31
4
18
 
5
19
  ### Fixed
@@ -61,6 +75,9 @@ replacement of `JOSE` format `algorithm` string
61
75
  - `TPM::EKCertificate` wrapper
62
76
  - `TPM::SAttest` wrapper
63
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/
80
+ [v0.10.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.9.0...v0.10.0/
64
81
  [v0.9.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.8.0...v0.9.0/
65
82
  [v0.8.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.7.0...v0.8.0/
66
83
  [v0.7.0]: https://github.com/cedarcode/tpm-key_attestation/compare/v0.6.0...v0.7.0/
@@ -72,3 +89,4 @@ replacement of `JOSE` format `algorithm` string
72
89
  [v0.1.0]: https://github.com/cedarcode/tpm-key_attestation/compare/57c926ef7e83830cee8d111fdc5ccaf99ab2e861...v0.1.0/
73
90
 
74
91
  [@santiagorodriguez96]: https://github.com/santiagorodriguez96
92
+ [@ClearlyClaire]: https://github.com/ClearlyClaire
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tpm-key_attestation (0.9.0)
4
+ tpm-key_attestation (0.11.0)
5
5
  bindata (~> 2.4)
6
- openssl-signature_algorithm (~> 0.4.0)
6
+ openssl (> 2.0)
7
+ openssl-signature_algorithm (~> 1.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -12,31 +13,33 @@ GEM
12
13
  bundler
13
14
  rake
14
15
  thor (>= 0.14.0)
15
- ast (2.4.0)
16
- bindata (2.4.7)
16
+ ast (2.4.2)
17
+ bindata (2.4.14)
17
18
  byebug (11.1.3)
18
- diff-lcs (1.3)
19
+ diff-lcs (1.4.4)
19
20
  jaro_winkler (1.5.4)
20
- openssl-signature_algorithm (0.4.0)
21
- parallel (1.19.1)
22
- parser (2.7.1.3)
23
- ast (~> 2.4.0)
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)
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: "../"
@@ -6,7 +6,7 @@ require "tpm/s_attest"
6
6
 
7
7
  module TPM
8
8
  class CertifyValidator
9
- attr_reader :info, :signature, :nonce, :object, :signature_algorithm, :hash_algorithm
9
+ attr_reader :info, :signature, :nonce, :public_area, :signature_algorithm, :hash_algorithm
10
10
 
11
11
  TPM_SIGNATURE_ALG_TO_OPENSSL = {
12
12
  ALG_RSASSA => OpenSSL::SignatureAlgorithm::RSAPKCS1,
@@ -16,14 +16,16 @@ module TPM
16
16
 
17
17
  TPM_HASH_ALG_TO_OPENSSL = {
18
18
  ALG_SHA1 => "SHA1",
19
- ALG_SHA256 => "SHA256"
19
+ ALG_SHA256 => "SHA256",
20
+ ALG_SHA384 => "SHA384",
21
+ ALG_SHA512 => "SHA512"
20
22
  }.freeze
21
23
 
22
- def initialize(info, signature, nonce, object, signature_algorithm: ALG_RSASSA, hash_algorithm: ALG_SHA256)
24
+ def initialize(info, signature, nonce, public_area, signature_algorithm: ALG_RSASSA, hash_algorithm: ALG_SHA256)
23
25
  @info = info
24
26
  @signature = signature
25
27
  @nonce = nonce
26
- @object = object
28
+ @public_area = public_area
27
29
  @signature_algorithm = signature_algorithm
28
30
  @hash_algorithm = hash_algorithm
29
31
  end
@@ -38,30 +40,38 @@ module TPM
38
40
  attest.attested_type == TPM::ST_ATTEST_CERTIFY &&
39
41
  attest.extra_data.buffer == nonce &&
40
42
  attest.magic == TPM::GENERATED_VALUE &&
41
- attest.attested.name.valid_for?(object)
43
+ attest.attested.name.valid_for?(public_area.name)
42
44
  end
43
45
 
44
46
  def valid_signature?(verify_key)
45
- openssl_signature_algorithm = openssl_signature_algorithm_class.new(openssl_hash_function[3..-1])
47
+ openssl_signature_algorithm = openssl_signature_algorithm_class.new(**openssl_signature_algorithm_parameters)
46
48
  openssl_signature_algorithm.verify_key = verify_key
47
-
48
- begin
49
- openssl_signature_algorithm.verify(signature, info)
50
- rescue OpenSSL::SignatureAlgorithm::Error
51
- false
52
- end
49
+ openssl_signature_algorithm.verify(signature, info)
50
+ rescue OpenSSL::SignatureAlgorithm::Error
51
+ false
53
52
  end
54
53
 
55
54
  def attest
56
55
  @attest ||= TPM::SAttest.deserialize(info)
57
56
  end
58
57
 
58
+ def openssl_signature_algorithm_parameters
59
+ parameters = { hash_function: openssl_hash_function }
60
+
61
+ if public_area.ecc?
62
+ parameters[:curve] = public_area.openssl_curve_name
63
+ end
64
+
65
+ parameters
66
+ end
67
+
59
68
  def openssl_hash_function
60
69
  TPM_HASH_ALG_TO_OPENSSL[hash_algorithm] || raise("Unsupported hash algorithm #{hash_algorithm}")
61
70
  end
62
71
 
63
72
  def openssl_signature_algorithm_class
64
- TPM_SIGNATURE_ALG_TO_OPENSSL[signature_algorithm] || raise("Unsupported signature algorithm #{algorithm}")
73
+ TPM_SIGNATURE_ALG_TO_OPENSSL[signature_algorithm] ||
74
+ raise("Unsupported signature algorithm #{signature_algorithm}")
65
75
  end
66
76
  end
67
77
  end
data/lib/tpm/constants.rb CHANGED
@@ -11,6 +11,8 @@ module TPM
11
11
  ALG_RSA = 0x0001
12
12
  ALG_SHA1 = 0x0004
13
13
  ALG_SHA256 = 0x000B
14
+ ALG_SHA384 = 0x000C
15
+ ALG_SHA512 = 0x000D
14
16
  ALG_NULL = 0x0010
15
17
  ALG_RSASSA = 0x0014
16
18
  ALG_RSAPSS = 0x0016
@@ -19,6 +21,8 @@ module TPM
19
21
 
20
22
  # ECC curves
21
23
  ECC_NIST_P256 = 0x0003
24
+ ECC_NIST_P384 = 0x0004
25
+ ECC_NIST_P521 = 0x0005
22
26
 
23
27
  # https://trustedcomputinggroup.org/resource/vendor-id-registry/ section 2 "TPM Capabilities Vendor ID (CAP_VID)"
24
28
  VENDOR_IDS = {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TPM
4
4
  class KeyAttestation
5
- VERSION = "0.9.0"
5
+ VERSION = "0.12.0"
6
6
  end
7
7
  end
@@ -2,14 +2,16 @@
2
2
 
3
3
  require "openssl"
4
4
  require "tpm/key_attestation/version"
5
+
5
6
  require "tpm/aik_certificate"
6
7
  require "tpm/certify_validator"
7
8
  require "tpm/constants"
9
+ require "tpm/public_area"
8
10
 
9
11
  module TPM
10
12
  class KeyAttestation
11
13
  # https://docs.microsoft.com/en-us/windows-server/security/guarded-fabric-shielded-vm/guarded-fabric-install-trusted-tpm-root-certificates
12
- ROOT_CERTIFICATES =
14
+ TRUSTED_CERTIFICATES =
13
15
  begin
14
16
  pattern = File.expand_path(File.join(__dir__, "certificates", "*", "RootCA", "*.*"))
15
17
  Dir.glob(pattern).map do |filename|
@@ -27,7 +29,7 @@ module TPM
27
29
  :signature_algorithm,
28
30
  :hash_algorithm,
29
31
  :qualifying_data,
30
- :root_certificates
32
+ :trusted_certificates
31
33
  )
32
34
 
33
35
  def initialize(
@@ -38,7 +40,7 @@ module TPM
38
40
  qualifying_data,
39
41
  signature_algorithm: ALG_RSASSA,
40
42
  hash_algorithm: ALG_SHA256,
41
- root_certificates: ROOT_CERTIFICATES
43
+ trusted_certificates: TRUSTED_CERTIFICATES
42
44
  )
43
45
  @certify_info = certify_info
44
46
  @signature = signature
@@ -48,7 +50,7 @@ module TPM
48
50
  @signature_algorithm = signature_algorithm
49
51
  @hash_algorithm = hash_algorithm
50
52
  @qualifying_data = qualifying_data
51
- @root_certificates = root_certificates
53
+ @trusted_certificates = trusted_certificates
52
54
  end
53
55
 
54
56
  def key
@@ -71,7 +73,7 @@ module TPM
71
73
  certify_info,
72
74
  signature,
73
75
  qualifying_data,
74
- certified_key,
76
+ public_area,
75
77
  signature_algorithm: signature_algorithm,
76
78
  hash_algorithm: hash_algorithm
77
79
  )
@@ -86,7 +88,7 @@ module TPM
86
88
  def trust_store
87
89
  @trust_store ||=
88
90
  OpenSSL::X509::Store.new.tap do |trust_store|
89
- 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) }
90
92
  end
91
93
  end
92
94
 
@@ -24,6 +24,14 @@ module TPM
24
24
  t_public.key
25
25
  end
26
26
 
27
+ def ecc?
28
+ t_public.ecc?
29
+ end
30
+
31
+ def openssl_curve_name
32
+ t_public.openssl_curve_name
33
+ end
34
+
27
35
  private
28
36
 
29
37
  def name_digest
data/lib/tpm/t_public.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bindata"
4
+ require "openssl"
4
5
  require "tpm/constants"
5
6
  require "tpm/sized_buffer"
6
7
  require "tpm/t_public/s_ecc_parms"
@@ -10,8 +11,16 @@ module TPM
10
11
  # Section 12.2.4 in https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-01.38.pdf
11
12
  class TPublic < BinData::Record
12
13
  BYTE_LENGTH = 8
13
- CURVE_TPM_TO_OPENSSL = { TPM::ECC_NIST_P256 => "prime256v1" }.freeze
14
+
15
+ CURVE_TPM_TO_OPENSSL = {
16
+ TPM::ECC_NIST_P256 => "prime256v1",
17
+ TPM::ECC_NIST_P384 => "secp384r1",
18
+ TPM::ECC_NIST_P521 => "secp521r1",
19
+ }.freeze
20
+
21
+ BN_BASE = 2
14
22
  RSA_KEY_DEFAULT_PUBLIC_EXPONENT = 2**16 + 1
23
+ ECC_UNCOMPRESSED_POINT_INDICATOR = "\x04"
15
24
 
16
25
  class << self
17
26
  alias_method :deserialize, :read
@@ -37,12 +46,19 @@ module TPM
37
46
  sized_buffer TPM::ALG_RSA
38
47
  end
39
48
 
49
+ def rsa?
50
+ alg_type == TPM::ALG_RSA
51
+ end
52
+
53
+ def ecc?
54
+ alg_type == TPM::ALG_ECC
55
+ end
56
+
40
57
  def key
41
58
  if parameters.symmetric == TPM::ALG_NULL
42
- case alg_type
43
- when TPM::ALG_ECC
59
+ if ecc?
44
60
  ecc_key
45
- when TPM::ALG_RSA
61
+ elsif rsa?
46
62
  rsa_key
47
63
  else
48
64
  raise "Type #{alg_type} not supported"
@@ -50,21 +66,33 @@ module TPM
50
66
  end
51
67
  end
52
68
 
69
+ def openssl_curve_name
70
+ if ecc?
71
+ CURVE_TPM_TO_OPENSSL[parameters.curve_id] || raise("Unknown curve #{parameters.curve_id}")
72
+ end
73
+ end
74
+
53
75
  private
54
76
 
55
77
  def ecc_key
56
78
  if parameters.scheme == TPM::ALG_ECDSA
57
- curve = CURVE_TPM_TO_OPENSSL[parameters.curve_id]
58
-
59
- if curve
60
- group = OpenSSL::PKey::EC::Group.new(curve)
61
- pkey = OpenSSL::PKey::EC.new(group)
62
- public_key_bn = OpenSSL::BN.new("\x04" + unique.buffer.value, 2)
63
- public_key_point = OpenSSL::PKey::EC::Point.new(group, public_key_bn)
64
- pkey.public_key = public_key_point
65
-
66
- pkey
67
- end
79
+ group = OpenSSL::PKey::EC::Group.new(openssl_curve_name)
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)
68
96
  end
69
97
  end
70
98
 
@@ -74,17 +102,22 @@ module TPM
74
102
  n = unique.buffer.value
75
103
 
76
104
  if parameters.key_bits / BYTE_LENGTH == n.size
77
- key = OpenSSL::PKey::RSA.new(parameters.key_bits.value)
78
- key.set_key(bn(n), bn(RSA_KEY_DEFAULT_PUBLIC_EXPONENT), nil)
79
-
80
- 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)
81
114
  end
82
115
  end
83
116
  end
84
117
 
85
118
  def bn(data)
86
119
  if data
87
- OpenSSL::BN.new(data, 2)
120
+ OpenSSL::BN.new(data, BN_BASE)
88
121
  end
89
122
  end
90
123
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bindata"
4
- require "tpm/public_area"
5
4
  require "tpm/tpmt_ha"
6
5
 
7
6
  module TPM
@@ -11,8 +10,8 @@ module TPM
11
10
  uint16 :name_size, value: lambda { name.to_binary_s.size }
12
11
  tpmt_ha :name, read_length: :name_size
13
12
 
14
- def valid_for?(object)
15
- name.to_binary_s == TPM::PublicArea.new(object).name
13
+ def valid_for?(other_name)
14
+ name.to_binary_s == other_name
16
15
  end
17
16
  end
18
17
  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-signature_algorithm", "~> 0.4.0"
29
+ spec.add_dependency "openssl", "> 2.0"
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.9.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-05-31 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,30 +24,44 @@ 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
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 0.4.0
47
+ version: '1.0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 0.4.0
41
- description:
42
- email:
54
+ version: '1.0'
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.3
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'