in cvm-attestation/AttestationClient.py [0:0]
def get_hardware_evidence(self) -> HardwareEvidence:
"""
Returns an instance of the HardwareEvidence class.
Returns
-------
HardwareEvidence
The current instance of the HardwareEvidence class.
"""
try:
self.log.info('Collecting hardware evidence...')
# Extract Hardware Report and Runtime Data
tss_wrapper = TssWrapper(self.log)
hcl_report = tss_wrapper.get_hcl_report(self.parameters.user_claims)
report_type = ReportParser.extract_report_type(hcl_report)
hw_report = ReportParser.extract_hw_report(hcl_report)
runtime_data = ReportParser.extract_runtimes_data(hcl_report)
isolation_type = self.parameters.isolation_type
if report_type == 'snp' and isolation_type == IsolationType.SEV_SNP:
self.log_snp_report(hw_report)
elif report_type == 'tdx' and isolation_type == IsolationType.TDX:
self.log.info("Fetching td quote...")
# Logs important TDX fields from the hardware report
imds_client = ImdsClient(self.log)
encoded_report = Encoder.base64url_encode(hw_report)
encoded_hw_evidence = imds_client.get_td_quote(encoded_report)
hw_report = Encoder.base64url_decode(encoded_hw_evidence)
self.log.info("Finished fetching td quote")
self.log.info("Hardware report parsing for TDX not supported yet")
else:
raise UnsupportedReportTypeException(f"Unsupported report type: {report_type}")
return HardwareEvidence(report_type, hw_report, runtime_data)
except Exception as e:
self.log.error(f"Error while reading hardware report. Exception {e}")