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(); subHeaderInfo += dsedSubHeader.toString();
} }
catch(NullPointerException e) { 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) { else if (subHeaderType == DeviceSecurityEventDataSubHeader.SUBHEADERTYPE_CERT_CHAIN) {
subHeaderInfo += "\n Cert chain to be implemented "; subHeaderInfo += "\n Cert chain to be implemented ";
try { try {
dsedSubHeader = dsedSubHeader =
new DeviceSecurityEventDataSubHeaderCertChain(dsedSubHeaderBytes); new DeviceSecurityEventDataSubHeaderCertChain(dsedSubHeaderBytes);

View File

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

View File

@ -1,6 +1,7 @@
package hirs.utils.tpm.eventlog.events; package hirs.utils.tpm.eventlog.events;
import hirs.utils.HexUtils; import hirs.utils.HexUtils;
import hirs.utils.tpm.eventlog.spdm.SpdmHa;
import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock;
import lombok.Getter; import lombok.Getter;
@ -75,4 +76,28 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve
// spdmMeasurementBlockList.add(spdmMeasurementBlock); // 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;
}
} }