Method: Tem::Cert.create_cert_from_tag

Defined in:
lib/tem/_cert.rb

.create_cert_from_tag(tag, issuer_cert) ⇒ Object

Parameters:

  • tag

    The tag read from the TEM

  • issuer_cert

    The OpenSSL::X509::Certificate of the entity that issued the TEM’s certificate



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/tem/_cert.rb', line 74

def self.create_cert_from_tag(tag, issuer_cert)
  cert = OpenSSL::X509::Certificate.new
  cert.public_key = Cert.extract_key(tag)
  cert.serial = Cert.extract_serial_num(tag)
  cert_name = OpenSSL::X509::Name.new [['CN', 'TEM Device'], ['L', 'Cambridge'], ['ST', 'Massachusetts'],\
                       ['O', 'Trusted Execution Modules, Inc.'], ['OU', 'Certificates Division'], ['C', 'US']]
  cert.issuer = issuer_cert.subject
  cert.subject = cert_name
  cert.not_before = Cert.extract_not_before(tag)
  cert.not_after = Cert.extract_not_after(tag)
  return cert
end