mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-04-18 08:10:14 +00:00
Updating code to use a different format for identifying failed components.
This commit is contained in:
parent
bdb32d13ad
commit
e8f5107137
HIRS_AttestationCA/src/main/java/hirs/attestationca/service
HIRS_Utils/src/main/java/hirs/validation
24
HIRS_AttestationCA/src/main/java/hirs/attestationca/service/SupplyChainValidationServiceImpl.java
24
HIRS_AttestationCA/src/main/java/hirs/attestationca/service/SupplyChainValidationServiceImpl.java
@ -84,6 +84,7 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
|
||||
|
||||
private static final Logger LOGGER
|
||||
= LogManager.getLogger(SupplyChainValidationServiceImpl.class);
|
||||
private static final int VALUE_INDEX = 1;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -270,6 +271,29 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
|
||||
return summary;
|
||||
}
|
||||
|
||||
private String updateUnmatchedComponents(final String unmatchedString) {
|
||||
StringBuilder updatedFailures = new StringBuilder();
|
||||
String manufacturer = "";
|
||||
String model = "";
|
||||
for (String rows : unmatchedString.split(";")) {
|
||||
for (String str : rows.split(",")) {
|
||||
String[] manufacturerSplit;
|
||||
String[] modelSplit;
|
||||
if (str.contains("Manufacturer")) {
|
||||
manufacturerSplit = str.split("=");
|
||||
manufacturer = manufacturerSplit[VALUE_INDEX];
|
||||
}
|
||||
if (str.contains("Model")) {
|
||||
modelSplit = str.split("=");
|
||||
model = modelSplit[VALUE_INDEX];
|
||||
}
|
||||
}
|
||||
updatedFailures.append(String.format("%s%s;", manufacturer, model));
|
||||
}
|
||||
|
||||
return updatedFailures.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is a sub set of the validate supply chain method and focuses
|
||||
* on the specific multibase validation check for a delta chain. This method
|
||||
|
@ -856,7 +856,7 @@ public final class SupplyChainCredentialValidator implements CredentialValidator
|
||||
for (ComponentIdentifier unmatchedComponent : pcUnmatchedComponents) {
|
||||
LOGGER.error("Unmatched component " + unmatchedComponentCounter++ + ": "
|
||||
+ unmatchedComponent);
|
||||
sb.append(String.format("Manufacturer=%s, Model=%s, Serial=%s, Revision=%s%n",
|
||||
sb.append(String.format("Manufacturer=%s, Model=%s, Serial=%s, Revision=%s;%n",
|
||||
unmatchedComponent.getComponentManufacturer(),
|
||||
unmatchedComponent.getComponentModel(),
|
||||
unmatchedComponent.getComponentSerial(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user