spdm cert chain parsing

This commit is contained in:
iadgovuser58 2024-08-01 17:31:14 -04:00
parent 0266b5293e
commit f2f5c52053
3 changed files with 29 additions and 2 deletions

View File

@ -72,11 +72,11 @@ public class DeviceSecurityEventData2 extends DeviceSecurityEvent {
subHeaderInfo += dsedSubHeader.toString();
}
catch(NullPointerException e) {
subHeaderInfo = "\n Could not interpret Sub header info for SPDM measurment block";
subHeaderInfo = "\n Could not interpret Sub header info for SPDM measurment block";
}
}
else if (subHeaderType == DeviceSecurityEventDataSubHeader.SUBHEADERTYPE_CERT_CHAIN) {
subHeaderInfo += "\n Cert chain to be implemented ";
subHeaderInfo += "\n Cert chain to be implemented ";
try {
dsedSubHeader =
new DeviceSecurityEventDataSubHeaderCertChain(dsedSubHeaderBytes);

View File

@ -39,6 +39,8 @@ public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventHeader {
private int length = 0;
/**
* Event sub headerType
* SUBHEADERTYPE_MEAS_BLOCK = 0
* SUBHEADERTYPE_CERT_CHAIN = 1
*/
@Getter
private int subHeaderType = 0;

View File

@ -1,6 +1,7 @@
package hirs.utils.tpm.eventlog.events;
import hirs.utils.HexUtils;
import hirs.utils.tpm.eventlog.spdm.SpdmHa;
import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock;
import lombok.Getter;
@ -75,4 +76,28 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve
// spdmMeasurementBlockList.add(spdmMeasurementBlock);
// }
}
/**
* Returns a human-readable description of the data within this structure.
*
* @return a description of this structure.
*/
public String toString() {
String dsedSubHeaderInfo = "";
// dsedSubHeaderInfo += "\n SPDM Version: " + spdmVersion;
// String spdmHashAlgoStr = SpdmHa.tcgAlgIdToString(spdmMeasurementHashAlgo);
// dsedSubHeaderInfo += "\n SPDM Hash Algorithm = " + spdmHashAlgoStr;
//
// // SPDM Measurement Block List output
// dsedSubHeaderInfo += "\n Number of SPDM Measurement Blocks = " + spdmMeasurementBlockList.size();
// int spdmMeasBlockCnt = 1;
// for (SpdmMeasurementBlock spdmMeasBlock : spdmMeasurementBlockList) {
// dsedSubHeaderInfo += "\n SPDM Measurement Block # " + spdmMeasBlockCnt++ + " of " +
// spdmMeasurementBlockList.size();
// dsedSubHeaderInfo += spdmMeasBlock.toString();
// }
return dsedSubHeaderInfo;
}
}