diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentAttributeRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentAttributeRepository.java index bfa101174..544506d43 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentAttributeRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentAttributeRepository.java @@ -20,7 +20,7 @@ public interface ComponentAttributeRepository extends JpaRepository findByProvisionSessionId(UUID provisionSessionId); + List findByProvisionSessionId(String provisionSessionId); /** * Query to look up Attribute Results based on the component id and the session id. diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentInfoRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentInfoRepository.java index 67fec4f09..fccf3d61c 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentInfoRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentInfoRepository.java @@ -13,6 +13,13 @@ public interface ComponentInfoRepository extends JpaRepository findByDeviceName(String deviceName); + /** + * Query that retrieves device components by device name and order them + * by component class + * @param deviceName string for the host name + * @return a list of device components + */ + List findByDeviceNameOrderByComponentClassAsc(String deviceName); /** * Query that retrieves device components by device name and diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentResultRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentResultRepository.java index ab4ae5920..277d5fc58 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentResultRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ComponentResultRepository.java @@ -17,6 +17,13 @@ public interface ComponentResultRepository extends JpaRepository findByBoardSerialNumber(String boardSerialNumber); + /** + * Query based on the device serial number. + * @param boardSerialNumber variable holding the device serial number + * @return a list of component result. + */ + List findByBoardSerialNumberOrderByComponentClassValueAsc(String boardSerialNumber); + /** * Query based on certificate serial number and device serial number. * @param certificateSerialNumber certificate specific serial number diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java index 690d82ca4..fb5803643 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java @@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.math.BigInteger; import java.util.List; import java.util.UUID; @@ -15,4 +16,5 @@ public interface PlatformCertificateRepository extends JpaRepository findByArchiveFlag(boolean archiveFlag); Page findByArchiveFlag(boolean archiveFlag, Pageable pageable); List findByDeviceId(UUID deviceId); + PlatformCredential findByPlatformSerialAndSerialNumber(String platformSerial, BigInteger serialNumber); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainValidationSummary.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainValidationSummary.java index 8793fe37e..d3b5eda76 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainValidationSummary.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/SupplyChainValidationSummary.java @@ -59,8 +59,12 @@ public class SupplyChainValidationSummary extends ArchivableEntity { targetEntity = SupplyChainValidation.class, orphanRemoval = true) private final Set validations; + @Getter + @Column + private String provisionSessionId; + @Getter @Column - private UUID provisionSessionId; + private String deviceName; /** * Default constructor necessary for Hibernate. @@ -70,6 +74,7 @@ protected SupplyChainValidationSummary() { overallValidationResult = AppraisalStatus.Status.FAIL; validations = Collections.emptySet(); this.message = Strings.EMPTY; + this.deviceName = Strings.EMPTY; } /** @@ -190,9 +195,10 @@ public static SupplyChainValidationSummary.Selector select( */ public SupplyChainValidationSummary(final Device device, final Collection validations, - final UUID provisionSessionId) { + final String provisionSessionId) { this(device, validations); this.provisionSessionId = provisionSessionId; + this.deviceName = this.device.getName(); } /** diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/ComponentResult.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/ComponentResult.java index db82b9ce4..3db685d7e 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/ComponentResult.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/ComponentResult.java @@ -15,6 +15,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Objects; +import java.util.UUID; /** * A component result is a DO to hold the status of a component validation status. This will @@ -45,7 +46,8 @@ public class ComponentResult extends ArchivableEntity { @Setter private boolean failedValidation; private String certificateType; - + @Setter + private UUID deviceInfo; private String issuerDN; private String certificateSerialNumber; private String boardSerialNumber; diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/attributes/ComponentAttributeResult.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/attributes/ComponentAttributeResult.java index 79b0ad528..a689e6a94 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/attributes/ComponentAttributeResult.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/certificate/attributes/ComponentAttributeResult.java @@ -6,6 +6,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.hibernate.annotations.JdbcTypeCode; import java.util.UUID; @@ -20,21 +21,25 @@ public class ComponentAttributeResult extends ArchivableEntity { private UUID componentId; + private UUID deviceComponentId; @Setter - private UUID provisionSessionId; + private String provisionSessionId; private String expectedValue; private String actualValue; /** * Default constructor that populates the expected and actual values. * @param componentId id associated with component result + * @param deviceComponentId id associated with the device component * @param expectedValue platform certificate value * @param actualValue paccor value from the device */ public ComponentAttributeResult(final UUID componentId, + final UUID deviceComponentId, final String expectedValue, final String actualValue) { this.componentId = componentId; + this.deviceComponentId = deviceComponentId; this.expectedValue = expectedValue; this.actualValue = actualValue; } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/ComponentInfo.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/ComponentInfo.java index 1e9e9c7ba..2a4e134ea 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/ComponentInfo.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/info/ComponentInfo.java @@ -10,6 +10,7 @@ import jakarta.xml.bind.annotation.XmlElement; import lombok.AccessLevel; import lombok.Getter; +import lombok.Setter; import lombok.NoArgsConstructor; import lombok.extern.log4j.Log4j2; import org.apache.commons.lang3.StringUtils; @@ -23,6 +24,7 @@ @Log4j2 @Entity @Getter +@Setter @NoArgsConstructor(access = AccessLevel.PROTECTED) @DiscriminatorColumn(name = "componentTypeEnum", discriminatorType = DiscriminatorType.STRING) public class ComponentInfo extends ArchivableEntity { @@ -53,13 +55,18 @@ public class ComponentInfo extends ArchivableEntity { @XmlElement @Column private String componentClass; + @Column + private String componentClassRegistry; + @Column + private String componentClassStr; /** * Base constructor for children. + * * @param componentManufacturer Component Manufacturer (must not be null) - * @param componentModel Component Model (must not be null) - * @param componentSerial Component Serial Number (can be null) - * @param componentRevision Component Revision or Version (can be null) + * @param componentModel Component Model (must not be null) + * @param componentSerial Component Serial Number (can be null) + * @param componentRevision Component Revision or Version (can be null) */ public ComponentInfo(final String componentManufacturer, final String componentModel, @@ -68,13 +75,15 @@ public ComponentInfo(final String componentManufacturer, this(DeviceInfoEnums.NOT_SPECIFIED, componentManufacturer, componentModel, componentSerial, componentRevision); } + /** * Constructor. - * @param deviceName the host machine associated with this component. (must not be null) + * + * @param deviceName the host machine associated with this component. (must not be null) * @param componentManufacturer Component Manufacturer (must not be null) - * @param componentModel Component Model (must not be null) - * @param componentSerial Component Serial Number (can be null) - * @param componentRevision Component Revision or Version (can be null) + * @param componentModel Component Model (must not be null) + * @param componentSerial Component Serial Number (can be null) + * @param componentRevision Component Revision or Version (can be null) */ public ComponentInfo(final String deviceName, final String componentManufacturer, @@ -108,23 +117,39 @@ public ComponentInfo(final String deviceName, /** * Constructor. - * @param deviceName the host machine associated with this component. + * + * @param deviceName the host machine associated with this component. * @param componentManufacturer Component Manufacturer (must not be null) - * @param componentModel Component Model (must not be null) - * @param componentSerial Component Serial Number (can be null) - * @param componentRevision Component Revision or Version (can be null) - * @param componentClass Component Class (can be null) + * @param componentModel Component Model (must not be null) + * @param componentSerial Component Serial Number (can be null) + * @param componentRevision Component Revision or Version (can be null) + * @param componentClass Component Class (can be null) + * @param componentClassRegistry The id that indicates TCG or SMBIOS */ public ComponentInfo(final String deviceName, final String componentManufacturer, final String componentModel, final String componentSerial, final String componentRevision, - final String componentClass) { + final String componentClass, + final String componentClassRegistry) { this(deviceName, componentManufacturer, componentModel, componentSerial, componentRevision); this.componentClass = Objects.requireNonNullElse(componentClass, StringUtils.EMPTY); + this.componentClassRegistry = Objects.requireNonNullElse(componentClassRegistry, StringUtils.EMPTY); + } + + /** + * Blank object to display on comparision page. + * @param empty nothing + */ + public ComponentInfo(final String empty) { + this.deviceName = StringUtils.EMPTY; + this.componentManufacturer = StringUtils.EMPTY; + this.componentModel = StringUtils.EMPTY; + this.componentSerial = StringUtils.EMPTY; + this.componentRevision = StringUtils.EMPTY; } /** @@ -134,9 +159,9 @@ public ComponentInfo(final String deviceName, * manufacturer and model are considered valid. * * @param componentManufacturer a String containing a component's manufacturer - * @param componentModel a String representing a component's model - * @param componentSerial a String representing a component's serial number - * @param componentRevision a String representing a component's revision + * @param componentModel a String representing a component's model + * @param componentSerial a String representing a component's serial number + * @param componentRevision a String representing a component's revision * @return true if the component is valid, false if not */ public static boolean isComplete(final String componentManufacturer, @@ -149,6 +174,7 @@ public static boolean isComplete(final String componentManufacturer, /** * Equals for the component info that just uses this classes attributes. + * * @param object the object to compare * @return the boolean result */ @@ -169,6 +195,7 @@ public boolean equals(Object object) { /** * Returns a hash code that is associated with common fields for components. + * * @return int value of the elements */ public int hashCommonElements() { @@ -178,6 +205,7 @@ public int hashCommonElements() { /** * Hash method for the attributes of this class. + * * @return int value that represents this class */ @Override diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java index d9c667064..929867478 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/SupplyChainValidationService.java @@ -55,7 +55,7 @@ public class SupplyChainValidationService { private CertificateRepository certificateRepository; private SupplyChainValidationRepository supplyChainValidationRepository; private SupplyChainValidationSummaryRepository supplyChainValidationSummaryRepository; - private UUID provisionSessionId; + private String provisionSessionId; /** * Constructor. @@ -109,7 +109,7 @@ public SupplyChainValidationSummary validateSupplyChain(final EndorsementCredent final Device device, final List componentInfos) { boolean acceptExpiredCerts = getPolicySettings().isExpiredCertificateValidationEnabled(); - provisionSessionId = UUID.randomUUID(); + provisionSessionId = UUID.randomUUID().toString(); PlatformCredential baseCredential = null; SupplyChainValidation platformScv = null; SupplyChainValidation basePlatformScv = null; diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationService.java index 84b229f00..fa22c2d06 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationService.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationService.java @@ -109,7 +109,7 @@ public static SupplyChainValidation evaluatePCAttributesStatus( final ComponentResultRepository componentResultRepository, final ComponentAttributeRepository componentAttributeRepository, final List componentInfos, - final UUID provisionSessionId) { + final String provisionSessionId) { final SupplyChainValidation.ValidationType validationType = SupplyChainValidation.ValidationType.PLATFORM_CREDENTIAL_ATTRIBUTES; diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/util/PciIds.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/util/PciIds.java index f2c682a34..aaec23691 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/util/PciIds.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/util/PciIds.java @@ -8,6 +8,7 @@ import hirs.attestationca.persist.entity.userdefined.certificate.attributes.ComponentClass; import hirs.attestationca.persist.entity.userdefined.certificate.attributes.ComponentIdentifier; import hirs.attestationca.persist.entity.userdefined.certificate.attributes.V2.ComponentIdentifierV2; +import hirs.attestationca.persist.entity.userdefined.info.ComponentInfo; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -135,6 +136,28 @@ public static List translateResults(final List return newList; } + /** + * Iterate through all components and translate PCI hardware IDs as necessary. It will only + * translate ComponentInfo objects as it relies on Component Class information. + * @param componentInfos List of ComponentInfos. + * @return the translated list of ComponentInfos. + */ + public static List translateDeviceComponentInfo(final List componentInfos) { + List newList = new ArrayList<>(); + if (componentInfos != null && !componentInfos.isEmpty()) { + for (final ComponentInfo componentInfo : componentInfos) { + if (!componentInfo.getDeviceName().isEmpty()) { + newList.add(translateDeviceComponentInfo(componentInfo)); + } else { + // if the object is all StringUtils.empty() + newList.add(componentInfo); + } + } + } + + return newList; + } + /** * Translate Vendor and Device IDs, if found, in ComponentIdentifierV2 objects. * It will only translate ID values, any other value will pass through. @@ -188,6 +211,23 @@ public static ComponentResult translateResult(final ComponentResult componentRes return newComponent; } + /** + * Translate Vendor and Device IDs, if found, in ComponentInfo objects. + * It will only translate ID values, any other value will pass through. + * @param componentInfo ComponentInfo object. + * @return the translated ComponentInfo object. + */ + public static ComponentInfo translateDeviceComponentInfo(final ComponentInfo componentInfo) { + ComponentInfo newComponent = null; + if (componentInfo != null) { + newComponent = componentInfo; + newComponent.setComponentManufacturer(translateVendor(componentInfo.getComponentManufacturer())); + newComponent.setComponentModel(translateDevice(componentInfo.getComponentManufacturer(), + componentInfo.getComponentModel())); + } + return newComponent; + } + /** * Look up the vendor name from the PCI IDs list, if the input string contains an ID. * If any part of this fails, return the original manufacturer value. diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CertificateAttributeScvValidator.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CertificateAttributeScvValidator.java index 2fdf50be8..9c61c283c 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CertificateAttributeScvValidator.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CertificateAttributeScvValidator.java @@ -208,7 +208,7 @@ public static AppraisalStatus validatePlatformCredentialAttributesV2p0( final ComponentResultRepository componentResultRepository, final ComponentAttributeRepository componentAttributeRepository, final List componentInfos, - final UUID provisionSessionId) { + final String provisionSessionId) { boolean passesValidation = true; StringBuilder resultMessage = new StringBuilder(); @@ -403,22 +403,22 @@ private static List generateComponentResults( // there are instances of components with the same class (ie hard disks, memory) List attributeResults = new ArrayList<>(); if (!componentInfo.getComponentManufacturer().equals(componentResult.getManufacturer())) { - attributeResults.add(new ComponentAttributeResult(componentResult.getId(), + attributeResults.add(new ComponentAttributeResult(componentResult.getId(), componentInfo.getId(), componentResult.getManufacturer(), componentInfo.getComponentManufacturer())); } if (!componentInfo.getComponentModel().equals(componentResult.getModel())) { - attributeResults.add(new ComponentAttributeResult(componentResult.getId(), + attributeResults.add(new ComponentAttributeResult(componentResult.getId(), componentInfo.getId(), componentResult.getModel(), componentInfo.getComponentModel())); } if (!componentInfo.getComponentSerial().equals(componentResult.getSerialNumber())) { - attributeResults.add(new ComponentAttributeResult(componentResult.getId(), + attributeResults.add(new ComponentAttributeResult(componentResult.getId(), componentInfo.getId(), componentResult.getSerialNumber(), componentInfo.getComponentSerial())); } if (!componentInfo.getComponentRevision().equals(componentResult.getRevisionNumber())) { - attributeResults.add(new ComponentAttributeResult(componentResult.getId(), + attributeResults.add(new ComponentAttributeResult(componentResult.getId(), componentInfo.getId(), componentResult.getRevisionNumber(), componentInfo.getComponentRevision())); } diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CredentialValidator.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CredentialValidator.java index 5917e1308..3337f8fc9 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CredentialValidator.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/CredentialValidator.java @@ -177,7 +177,7 @@ public static AppraisalStatus validatePlatformCredentialAttributes( final ComponentResultRepository componentResultRepository, final ComponentAttributeRepository componentAttributeRepository, final List componentInfos, - final UUID provisionSessionId) { + final String provisionSessionId) { final String baseErrorMessage = "Can't validate platform credential attributes without "; String message; if (platformCredential == null) { diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidator.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidator.java index ef378990f..eaf2872b3 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidator.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidator.java @@ -301,16 +301,19 @@ public static List getComponentInfoFromPaccorOutput(final String } else { // version 2 String componentClass = StringUtils.EMPTY; + String componentClassRegistry = StringUtils.EMPTY; for (JsonNode subNode : compClassNodes) { componentClass = getJSONNodeValueAsText(subNode, "COMPONENTCLASSVALUE"); + componentClassRegistry = getJSONNodeValueAsText(subNode, + "COMPONENTCLASSREGISTRY"); } componentInfoList.add(new ComponentInfo(hostName, getJSONNodeValueAsText(next, "MANUFACTURER"), getJSONNodeValueAsText(next, "MODEL"), getJSONNodeValueAsText(next, "SERIAL"), getJSONNodeValueAsText(next, "REVISION"), - componentClass)); + componentClass, componentClassRegistry)); } } } diff --git a/HIRS_AttestationCA/src/test/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidatorTest.java b/HIRS_AttestationCA/src/test/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidatorTest.java index 8570c0678..1c66cb135 100644 --- a/HIRS_AttestationCA/src/test/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidatorTest.java +++ b/HIRS_AttestationCA/src/test/java/hirs/attestationca/persist/validation/SupplyChainCredentialValidatorTest.java @@ -345,7 +345,7 @@ public final void validateIntelPlatformCredentialAttributes() AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -377,7 +377,7 @@ public final void validatePlatformCredentialWithDeviceBaseboard() AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -408,7 +408,7 @@ public final void validatePlatformCredentialWithDeviceChassis() AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -441,7 +441,7 @@ public final void validatePlatformCredentialWithDeviceSystemSerialNumber() AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -473,7 +473,7 @@ public final void validatePlatformCredentialCombinedWithChassisSerialNumbersMatc AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -504,7 +504,7 @@ public final void validatePlatformCredentialCombinedWithBaseboardSerialNumbersMa AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -535,7 +535,7 @@ public final void validatePlatformCredentialCombinedWithSystemSerialNumbersMatch AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -570,7 +570,7 @@ public final void validatePlatformCredentialWithNoDeviceSerialNumbers() AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes( pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals(expectedMessage, result.getMessage()); } @@ -603,7 +603,7 @@ public final void validatePlatformCredentialCombinedWithNoMatchedDeviceSerialNum AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes( pc, deviceInfoReport, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals(expectedMessage, result.getMessage()); } @@ -984,7 +984,7 @@ public final void verifyPlatformCredentialNullDeviceInfoReport() AppraisalStatus result = CredentialValidator.validatePlatformCredentialAttributes(pc, null, ec, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals(expectedMessage, result.getMessage()); } @@ -1241,7 +1241,7 @@ public final void testValidatePlatformCredentialAttributesV2p0NoComponentsPass() AppraisalStatus appraisalStatus = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, appraisalStatus.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, @@ -1261,7 +1261,7 @@ public final void testValidatePlatformCredentialAttributesV2p0WithComponentsPass AppraisalStatus appraisalStatus = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, appraisalStatus.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, appraisalStatus.getMessage()); @@ -1283,7 +1283,7 @@ public final void testValPCAttributesV2p0WithComponentsPassPlatformSerialWithSys AppraisalStatus appraisalStatus = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, appraisalStatus.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, appraisalStatus.getMessage()); @@ -1307,7 +1307,7 @@ public final void testValPCAttributesV2p0WithComponentsPassPlatformSerialWithSys AppraisalStatus appraisalStatus = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, appraisalStatus.getAppStatus()); } @@ -1324,7 +1324,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1332,7 +1332,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Platform manufacturer did not match\n", result.getMessage()); @@ -1340,7 +1340,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1348,7 +1348,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(result.getAppStatus(), AppraisalStatus.Status.FAIL); assertEquals(result.getMessage(), "Platform model did not match\n"); @@ -1356,7 +1356,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1364,13 +1364,13 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); platformCredential = setupMatchingPlatformCredential(deviceInfoReport); result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1378,7 +1378,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1387,7 +1387,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1398,7 +1398,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Component manufacturer is empty\n", result.getMessage()); @@ -1406,7 +1406,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1416,7 +1416,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsNull result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Component model is empty\n", result.getMessage()); @@ -1436,7 +1436,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1444,7 +1444,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Platform manufacturer did not match\n", result.getMessage()); @@ -1452,7 +1452,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1460,7 +1460,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Platform model did not match\n", result.getMessage()); @@ -1468,7 +1468,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1476,7 +1476,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Platform serial did not match\n", result.getMessage()); @@ -1484,7 +1484,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1492,7 +1492,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Platform version did not match\n", result.getMessage()); @@ -1500,7 +1500,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1511,7 +1511,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Component manufacturer is empty\n" + "There are unmatched components:\n" @@ -1523,7 +1523,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1533,7 +1533,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredFieldsEmpt result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Component model is empty\n", result.getMessage()); } @@ -1552,7 +1552,7 @@ public final void testValidatePlatformCredentialAttributesV2p0MissingComponentIn AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1574,7 +1574,7 @@ public final void testValidatePlatformCredentialAttributesV2p0MissingComponentIn result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("There are unmatched components:\n" + "Manufacturer=ACME, Model=TNT, Serial=2, Revision=1.1;\n", @@ -1600,7 +1600,7 @@ public final void testValidatePlatformCredentialAttributesV2p0ExtraComponentInDe AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1608,7 +1608,7 @@ public final void testValidatePlatformCredentialAttributesV2p0ExtraComponentInDe result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1628,7 +1628,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredComponentF AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1641,7 +1641,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredComponentF result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Component manufacturer is empty\n" + "There are unmatched components:\n" @@ -1653,7 +1653,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredComponentF result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1665,7 +1665,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredComponentF result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.FAIL, result.getAppStatus()); assertEquals("Component model is empty\n", result.getMessage()); } @@ -1695,7 +1695,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredComponentN AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1726,7 +1726,7 @@ public final void testValidatePlatformCredentialAttributesV2p0RequiredComponentN AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); @@ -1759,7 +1759,7 @@ public final void testValPlatCredentialAttributesV2p0RequiredComponentNoSerialOr AppraisalStatus result = CertificateAttributeScvValidator .validatePlatformCredentialAttributesV2p0(platformCredential, deviceInfoReport, null, null, - Collections.emptyList(), UUID.randomUUID()); + Collections.emptyList(), UUID.randomUUID().toString()); assertEquals(AppraisalStatus.Status.PASS, result.getAppStatus()); assertEquals(SupplyChainCredentialValidator.PLATFORM_ATTRIBUTES_VALID, result.getMessage()); diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/Page.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/Page.java index 0c0a6a393..d366bae09 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/Page.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/Page.java @@ -40,6 +40,10 @@ public enum Page { * Non-menu page to display certificate. Reachable from all certificate pages. */ CERTIFICATE_DETAILS("Certificate Details", "", null, true, false, null, null), + /** + * Non-menu page to display certificate. Reachable from all certificate pages. + */ + COMPONENT_COMPARISON("Component Comparison", "", null, true, false, null, null), /** * Page to display registered devices. */ diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificatePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificatePageController.java index 4b3f00d39..256334eac 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificatePageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificatePageController.java @@ -211,7 +211,7 @@ public DataTableResponse getTableData( log.debug("Handling list request: " + input); // attempt to get the column property based on the order index. - String orderColumnName = input.getOrderColumnName(); + String orderColumnName = input.getOrderColumnName();//input.getSearch(); log.debug("Ordering on column: " + orderColumnName); // check that the alert is not archived and that it is in the specified report @@ -274,7 +274,8 @@ public void modify(final CriteriaQuery criteriaQuery) { return new DataTableResponse<>(records, input); } else if (certificateType.equals(ENDORSEMENTCREDENTIAL)) { FilteredRecordsList records = new FilteredRecordsList<>(); - org.springframework.data.domain.Page pagedResult = this.endorsementCredentialRepository.findByArchiveFlag(false, paging); + org.springframework.data.domain.Page pagedResult + = this.endorsementCredentialRepository.findByArchiveFlag(false, paging); if (pagedResult.hasContent()) { records.addAll(pagedResult.getContent()); @@ -289,7 +290,8 @@ public void modify(final CriteriaQuery criteriaQuery) { return new DataTableResponse<>(records, input); } else if (certificateType.equals(TRUSTCHAIN)) { FilteredRecordsList records = new FilteredRecordsList<>(); - org.springframework.data.domain.Page pagedResult = this.caCredentialRepository.findByArchiveFlag(false, paging); + org.springframework.data.domain.Page pagedResult + = this.caCredentialRepository.findByArchiveFlag(false, paging); if (pagedResult.hasContent()) { records.addAll(pagedResult.getContent()); diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ComponentComparisonPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ComponentComparisonPageController.java new file mode 100644 index 000000000..9c8d85c29 --- /dev/null +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ComponentComparisonPageController.java @@ -0,0 +1,261 @@ +package hirs.attestationca.portal.page.controllers; + +import hirs.attestationca.persist.entity.manager.ComponentAttributeRepository; +import hirs.attestationca.persist.entity.manager.ComponentInfoRepository; +import hirs.attestationca.persist.entity.manager.ComponentResultRepository; +import hirs.attestationca.persist.entity.manager.PlatformCertificateRepository; +import hirs.attestationca.persist.entity.userdefined.certificate.ComponentResult; +import hirs.attestationca.persist.entity.userdefined.certificate.PlatformCredential; +import hirs.attestationca.persist.entity.userdefined.certificate.attributes.ComponentAttributeResult; +import hirs.attestationca.persist.entity.userdefined.certificate.attributes.ComponentClass; +import hirs.attestationca.persist.entity.userdefined.info.ComponentInfo; +import hirs.attestationca.persist.util.PciIds; +import hirs.attestationca.portal.page.Page; +import hirs.attestationca.portal.page.PageController; +import hirs.attestationca.portal.page.PageMessages; +import hirs.attestationca.portal.page.params.CertificateDetailsPageParams; +import hirs.utils.xjc.Link; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +@Log4j2 +@Controller +@RequestMapping("/HIRS_AttestationCAPortal/portal/component-comparison") +public class ComponentComparisonPageController extends PageController { + + private final PlatformCertificateRepository platformCertificateRepository; + private final ComponentResultRepository componentResultRepository; + private final ComponentInfoRepository componentInfoRepository; + private final ComponentAttributeRepository componentAttributeRepository; + + @Autowired + public ComponentComparisonPageController(final PlatformCertificateRepository platformCertificateRepository, + final ComponentResultRepository componentResultRepository, + final ComponentInfoRepository componentInfoRepository, + final ComponentAttributeRepository componentAttributeRepository) { + super(Page.COMPONENT_COMPARISON); + this.platformCertificateRepository = platformCertificateRepository; + this.componentResultRepository = componentResultRepository; + this.componentInfoRepository = componentInfoRepository; + this.componentAttributeRepository = componentAttributeRepository; + } + + /** + * Returns the path for the view and the data model for the page. + * + * @param params The object to map url parameters into. + * @param model The data model for the request. Can contain data from + * redirect. + * @return the path for the view and data model for the page. + */ + @Override + @RequestMapping + public ModelAndView initPage(final CertificateDetailsPageParams params, final Model model) { + // get the basic information to render the page + ModelAndView mav = getBaseModelAndView(); + PageMessages messages = new PageMessages(); + // Map with the certificate information + HashMap data = new HashMap<>(); + + mav.addObject(MESSAGES_ATTRIBUTE, messages); + // Check if parameters were set + if (params.getSessionId() == null) { + String typeError = "ID was not provided"; + messages.addError(typeError); + log.debug(typeError); + mav.addObject(MESSAGES_ATTRIBUTE, messages); + } else { + try { + String uuid = params.getSessionId(); + data.putAll(getPlatformComponentInformation(uuid, params.getDeviceName(), + platformCertificateRepository, componentResultRepository, + componentInfoRepository, + componentAttributeRepository)); + } catch (IllegalArgumentException iaEx) { + String uuidError = "Failed to parse ID from: " + params.getId(); + messages.addError(uuidError); + log.error(uuidError, iaEx); + } catch (IOException ioEx) { + log.error(ioEx); + } catch (Exception ex) { + log.error(ex); + } + + if (data.isEmpty()) { + String notFoundMessage = "Unable to find session with ID: " + params.getId(); + messages.addError(notFoundMessage); + log.warn(notFoundMessage); + mav.addObject(MESSAGES_ATTRIBUTE, messages); + } else { + mav.addObject(INITIAL_DATA, data); + } + } + + return mav; + } + + /** + * Compiles and returns Platform Certificate component information. + * + * @param uuid ID for the certificate. + * @param certificateRepository the certificate manager for retrieving certs. + * @return a hash map with the endorsement certificate information. + * @throws IOException when parsing the certificate + * @throws IllegalArgumentException invalid argument on parsing the certificate + */ + public static HashMap getPlatformComponentInformation( + final String sessionId, final String deviceName, + final PlatformCertificateRepository platformCertificateRepository, + final ComponentResultRepository componentResultRepository, + final ComponentInfoRepository componentInfoRepository, + final ComponentAttributeRepository componentAttributeRepository) + throws IllegalArgumentException, IOException { + HashMap data = new HashMap<>(); + List componentResults = new ArrayList<>(); + PlatformCredential platformCredential = null; + List attributeResults = componentAttributeRepository + .findByProvisionSessionId(sessionId); + + data.put("deviceName", deviceName); + if (!attributeResults.isEmpty()) { + ComponentResult componentResult = componentResultRepository.findById(attributeResults.get(0).getComponentId()).get(); + platformCredential = platformCertificateRepository + .findByPlatformSerialAndSerialNumber(componentResult.getBoardSerialNumber(), + BigInteger.valueOf(Long.parseLong( + componentResult.getCertificateSerialNumber()))); + + if (platformCredential != null) { + data.put("certificateId", platformCredential.getId()); + data.put("boardNumber", platformCredential.getPlatformSerial()); + data.put("certificateSerialNumber", platformCredential.getSerialNumber()); + data.put("platformManufacturer", platformCredential.getManufacturer()); + data.put("platformModel", platformCredential.getModel()); + } else { + log.error("Can't find platform certificate " + + componentResults.get(0).getBoardSerialNumber()); + return data; + } + // get all db objects + componentResults = componentResultRepository + .findByBoardSerialNumberOrderByComponentClassValueAsc( + platformCredential.getPlatformSerial()); + List componentInfos = componentInfoRepository + .findByDeviceNameOrderByComponentClassAsc(deviceName); + // first get what we know, the attribute results have the platform component + // and device component that are mismatched + List mismatchedResults = new LinkedList<>(); + List mismatchedDeviceComps = new LinkedList<>(); + // quick list to hold what we've found so we don't look for the ID again. + List tempIds = new ArrayList<>(); + for (ComponentAttributeResult car : attributeResults) { + if (!tempIds.contains(car.getComponentId())) { + mismatchedResults.add(componentResultRepository + .getReferenceById(car.getComponentId())); + tempIds.add(car.getComponentId()); + } + if (!tempIds.contains(car.getDeviceComponentId())) { + mismatchedDeviceComps.add(componentInfoRepository + .getReferenceById(car.getDeviceComponentId())); + tempIds.add(car.getDeviceComponentId()); + } + } + + // we got the provisioned mismatches, so all that is left are matched + Map deviceComponentHashMap = new HashMap<>(); + for (ComponentInfo componentInfo : componentInfos) { + // skip the ones we know + if (!tempIds.contains(componentInfo.getId())) { + deviceComponentHashMap.put(componentInfo.hashCommonElements(), componentInfo); + } + } + // do the same for componentResults + Map platformComponentHashMap = new HashMap<>(); + for (ComponentResult result : componentResults) { + // skip the ones we know + if (!tempIds.contains(result.getId())) { + platformComponentHashMap.put(result.hashCommonElements(), result); + } + } + + // find platform component match + Map mappedComponents = new HashMap<>(); + for (Integer key : platformComponentHashMap.keySet()) { + if (deviceComponentHashMap.containsKey(key)) { + mappedComponents.put(platformComponentHashMap.get(key), + deviceComponentHashMap.get(key)); + deviceComponentHashMap.remove(key); + } else { + // it doesn't exist, put null + mappedComponents.put(platformComponentHashMap.get(key), new ComponentInfo("")); + } + } + + List matchedResults = new LinkedList<>(mappedComponents.keySet()); + List matchedDeviceComps = new LinkedList<>(mappedComponents.values()); + List notFoundDevices = null; + if (!deviceComponentHashMap.values().isEmpty()) { + notFoundDevices = new ArrayList<>(deviceComponentHashMap.values()); + } + if (PciIds.DB.isReady()) { + matchedResults = PciIds.translateResults(matchedResults); + matchedDeviceComps = PciIds.translateDeviceComponentInfo(matchedDeviceComps); + mismatchedResults = PciIds.translateResults(mismatchedResults); + mismatchedDeviceComps = PciIds.translateDeviceComponentInfo(mismatchedDeviceComps); + if (notFoundDevices != null) { + notFoundDevices = PciIds.translateDeviceComponentInfo(notFoundDevices); + } + } + + matchedDeviceComps = translateComponentClass(matchedDeviceComps); + mismatchedDeviceComps = translateComponentClass(mismatchedDeviceComps); + + data.put("componentResults", matchedResults); + data.put("componentInfos", matchedDeviceComps); + data.put("misMatchedComponentResults", mismatchedResults); + data.put("misMatchedComponentInfos", mismatchedDeviceComps); + + if (notFoundDevices != null) { + data.put("notFoundDeviceComponents", translateComponentClass(notFoundDevices)); + } + + } else { + String notFoundMessage = "No components attribute comparison found " + + "with ID: " + sessionId; + log.error(notFoundMessage); + } + return data; + } + + private static List translateComponentClass(final List componentInfos) { + List tempList = new ArrayList<>(); + ComponentInfo componentInfo; + ComponentClass componentClass; + for (ComponentInfo info : componentInfos) { + if (!info.getDeviceName().isEmpty()) { + componentInfo = info; + componentClass = new ComponentClass(info.getComponentClassRegistry(), info.getComponentClass()); + componentInfo.setComponentClassStr(componentClass.toString()); + tempList.add(componentInfo); + } else { + tempList.add(info); + } + } + + return tempList; + } +} + + diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/params/CertificateDetailsPageParams.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/params/CertificateDetailsPageParams.java index c4c073821..da800b5f1 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/params/CertificateDetailsPageParams.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/params/CertificateDetailsPageParams.java @@ -17,6 +17,8 @@ public class CertificateDetailsPageParams implements PageParams { private String id; private String type; + private String sessionId; + private String deviceName; /** * Constructor to set ID Certificate Details URL parameters. @@ -33,6 +35,8 @@ public CertificateDetailsPageParams(final String id) { public CertificateDetailsPageParams() { id = null; type = null; + sessionId = null; + deviceName = null; } /** @@ -55,5 +59,4 @@ public String toString() { + "type: " + type + "}"; } - } diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/certificate-details.jsp b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/certificate-details.jsp index 93a49c3b3..c69728f11 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/certificate-details.jsp +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/certificate-details.jsp @@ -26,10 +26,19 @@ - Platform Certificate - - - + + + Platform Certificate + + + + + + + + Platform Component Comparison + + Issued Attestation Certificates diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/component-comparison.jsp b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/component-comparison.jsp new file mode 100644 index 000000000..acbaa214f --- /dev/null +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/component-comparison.jsp @@ -0,0 +1,107 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%-- JSP TAGS --%> +<%@taglib prefix="c" uri="jakarta.tags.core" %> +<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%> +<%@taglib prefix="fn" uri="jakarta.tags.functions"%> +<%@taglib prefix="my" tagdir="/WEB-INF/tags"%> + +<%--CONTENT--%> + + + + + + Platform Component Failure Comparison + + + + + + +
+
+
+
Platform Information
+
+ +
Device: ${initialData.deviceName} +
+
+ +
Platform Certificate:  + + ${initialData.boardNumber} + +
+
+
+
+
+
+
+
+
Certificate Component
+ +
+ +
+ Component Class: ${componentResult.getComponentClassStr()}
+ Manufacturer: ${componentResult.getManufacturer()}
+ Model: ${componentResult.getModel()}
+ Serial Number: ${componentResult.getSerialNumber()}
+ Revision: ${componentResult.getRevisionNumber()}
+
+
+ +
+ Component Class: ${componentResult.getComponentClassStr()}
+ Manufacturer: ${componentResult.getManufacturer()}
+ Model: ${componentResult.getModel()}
+ Serial Number: ${componentResult.getSerialNumber()}
+ Revision: ${componentResult.getRevisionNumber()}
+
+
+
+
+
+
Device Components
+ +
+ +
+ Component Class: ${componentInfo.getComponentClassStr()}
+ Manufacturer: ${componentInfo.getComponentManufacturer()}
+ Model: ${componentInfo.getComponentModel()}
+ Serial Number: ${componentInfo.getComponentSerial()}
+ Revision: ${componentInfo.getComponentRevision()}
+
+
+ +
+ Component Class: ${componentInfo.getComponentClassStr()}
+ Manufacturer: ${componentInfo.getComponentManufacturer()}
+ Model: ${componentInfo.getComponentModel()}
+ Serial Number: ${componentInfo.getComponentSerial()}
+ Revision: ${componentInfo.getComponentRevision()}
+
+
+ +
+ Component Class: ${componentInfo.getComponentClassStr()}
+ Manufacturer: ${componentInfo.getComponentManufacturer()}
+ Model: ${componentInfo.getComponentModel()}
+ Serial Number: ${componentInfo.getComponentSerial()}
+ Revision: ${componentInfo.getComponentRevision()}
+
+
+
+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/error.jsp b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/error.jsp index 88bb88771..47771d782 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/error.jsp +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/error.jsp @@ -9,7 +9,7 @@ Error - 404 - +
Exception Message:
+
from URL ->
\ No newline at end of file diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/validation-reports.jsp b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/validation-reports.jsp index f74fdbe8c..e5a48284b 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/validation-reports.jsp +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/validation-reports.jsp @@ -185,6 +185,7 @@ var curValidation = full.validations[i]; var curResult = curValidation.validationResult; var curMessage = curValidation.message; + var deviceName = full.deviceName if (curValidation.validationType === validation_type) { var unknownStatus = ''; @@ -207,13 +208,20 @@ } switch (validation_type) { + case "ENDORSEMENT_CREDENTIAL": case "PLATFORM_CREDENTIAL": case "PLATFORM_CREDENTIAL_ATTRIBUTES": - case "ENDORSEMENT_CREDENTIAL": + if (curMessage.includes("attributes")) { + html += ''; + break; + } else { html += ''; - break; + break; + } } } diff --git a/HIRS_AttestationCAPortal/src/main/webapp/common/certificate_details.css b/HIRS_AttestationCAPortal/src/main/webapp/common/certificate_details.css index 5cafa4662..bb2e71811 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/common/certificate_details.css +++ b/HIRS_AttestationCAPortal/src/main/webapp/common/certificate_details.css @@ -39,6 +39,10 @@ width: 100px; display: inline-block; } +.compHeader { + width: 150px; + display: inline-block; +} #tbbsecurity .fieldHeader { width: 165px;