Class: TPM::CertifyValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/tpm/certify_validator.rb

Constant Summary collapse

TPM_SIGNATURE_ALG_TO_OPENSSL =
{
  ALG_RSASSA => OpenSSL::SignatureAlgorithm::RSAPKCS1,
  ALG_RSAPSS => OpenSSL::SignatureAlgorithm::RSAPSS,
  ALG_ECDSA => OpenSSL::SignatureAlgorithm::ECDSA
}.freeze
TPM_HASH_ALG_TO_OPENSSL =
{
  ALG_SHA1 => "SHA1",
  ALG_SHA256 => "SHA256",
  ALG_SHA384 => "SHA384",
  ALG_SHA512 => "SHA512"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info, signature, nonce, public_area, signature_algorithm: ALG_RSASSA, hash_algorithm: ALG_SHA256) ⇒ CertifyValidator

Returns a new instance of CertifyValidator.



24
25
26
27
28
29
30
31
# File 'lib/tpm/certify_validator.rb', line 24

def initialize(info, signature, nonce, public_area, signature_algorithm: ALG_RSASSA, hash_algorithm: ALG_SHA256)
  @info = info
  @signature = signature
  @nonce = nonce
  @public_area = public_area
  @signature_algorithm = signature_algorithm
  @hash_algorithm = hash_algorithm
end

Instance Attribute Details

#hash_algorithmObject (readonly)

Returns the value of attribute hash_algorithm.



9
10
11
# File 'lib/tpm/certify_validator.rb', line 9

def hash_algorithm
  @hash_algorithm
end

#infoObject (readonly)

Returns the value of attribute info.



9
10
11
# File 'lib/tpm/certify_validator.rb', line 9

def info
  @info
end

#nonceObject (readonly)

Returns the value of attribute nonce.



9
10
11
# File 'lib/tpm/certify_validator.rb', line 9

def nonce
  @nonce
end

#public_areaObject (readonly)

Returns the value of attribute public_area.



9
10
11
# File 'lib/tpm/certify_validator.rb', line 9

def public_area
  @public_area
end

#signatureObject (readonly)

Returns the value of attribute signature.



9
10
11
# File 'lib/tpm/certify_validator.rb', line 9

def signature
  @signature
end

#signature_algorithmObject (readonly)

Returns the value of attribute signature_algorithm.



9
10
11
# File 'lib/tpm/certify_validator.rb', line 9

def signature_algorithm
  @signature_algorithm
end

Instance Method Details

#valid?(signing_key) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/tpm/certify_validator.rb', line 33

def valid?(signing_key)
  valid_info? && valid_signature?(signing_key)
end