lib/tpm/key_attestation.rb in tpm-key_attestation-0.5.0 vs lib/tpm/key_attestation.rb in tpm-key_attestation-0.6.0
- old
+ new
@@ -1,23 +1,41 @@
# frozen_string_literal: true
require "tpm/key_attestation/version"
require "tpm/certify_validator"
+require "tpm/constants"
module TPM
class KeyAttestation
class Error < StandardError; end
- attr_reader :certify_info, :signature, :certified_object, :signing_key, :algorithm, :qualifying_data
+ attr_reader(
+ :certify_info,
+ :signature,
+ :certified_object,
+ :signing_key,
+ :signature_algorithm,
+ :hash_algorithm,
+ :qualifying_data
+ )
- def initialize(certify_info, signature, certified_object, signing_key, qualifying_data, algorithm: "RS256")
+ def initialize(
+ certify_info,
+ signature,
+ certified_object,
+ signing_key,
+ qualifying_data,
+ signature_algorithm: ALG_RSASSA,
+ hash_algorithm: ALG_SHA256
+ )
@certify_info = certify_info
@signature = signature
@certified_object = certified_object
@signing_key = signing_key
- @algorithm = algorithm
+ @signature_algorithm = signature_algorithm
+ @hash_algorithm = hash_algorithm
@qualifying_data = qualifying_data
end
def key
if certify_validator.valid?(signing_key)
@@ -36,10 +54,11 @@
TPM::CertifyValidator.new(
certify_info,
signature,
qualifying_data,
certified_object,
- algorithm: algorithm
+ signature_algorithm: signature_algorithm,
+ hash_algorithm: hash_algorithm
)
end
def public_area
@public_area ||= TPM::PublicArea.new(certified_object)