From 468cbc07979bae0dc81aa836ffbf6f1f4d20bb3d Mon Sep 17 00:00:00 2001
From: Cyrus <24922493+cyrus-dev@users.noreply.github.com>
Date: Mon, 6 Mar 2023 20:54:49 -0500
Subject: [PATCH] Finished up the rest of it
---
HIRS_AttestationCAPortal/build.gradle | 57 +-
.../portal/persist/entity/AbstractEntity.java | 100 --
.../portal/persist/entity/Appraiser.java | 88 --
.../persist/entity/ArchivableEntity.java | 95 --
.../portal/persist/entity/Policy.java | 72 --
.../persist/entity/UserDefinedEntity.java | 47 -
.../entity/manager/DeviceRepository.java | 13 -
.../manager/ReferenceManifestRepository.java | 9 -
.../entity/manager/SettingsRepository.java | 12 -
.../portal/persist/entity/package-info.java | 4 -
.../entity/userdefined/Certificate.java | 1076 -----------------
.../persist/entity/userdefined/Device.java | 63 -
.../userdefined/ReferenceDigestValue.java | 72 --
.../entity/userdefined/ReferenceManifest.java | 157 ---
.../persist/entity/userdefined/Report.java | 41 -
.../userdefined/SupplyChainSettings.java | 123 --
.../CertificateAuthorityCredential.java | 151 ---
.../certificate/CertificateVariables.java | 47 -
.../certificate/ConformanceCredential.java | 65 -
.../DeviceAssociatedCertificate.java | 69 --
.../certificate/EndorsementCredential.java | 716 -----------
.../IssuedAttestationCertificate.java | 105 --
.../certificate/PlatformCredential.java | 796 ------------
.../attributes/CommonCriteriaMeasures.java | 300 -----
.../attributes/ComponentAddress.java | 91 --
.../attributes/ComponentClass.java | 248 ----
.../attributes/ComponentIdentifier.java | 231 ----
.../certificate/attributes/FIPSLevel.java | 122 --
.../attributes/PlatformConfiguration.java | 104 --
.../attributes/PlatformConfigurationV1.java | 105 --
.../attributes/PlatformProperty.java | 67 -
.../attributes/TBBSecurityAssertion.java | 282 -----
.../attributes/TPMSecurityAssertions.java | 121 --
.../attributes/TPMSpecification.java | 58 -
.../certificate/attributes/URIReference.java | 91 --
.../attributes/V2/AttributeStatus.java | 40 -
.../attributes/V2/CertificateIdentifier.java | 127 --
.../attributes/V2/ComponentIdentifierV2.java | 251 ----
.../V2/PlatformConfigurationV2.java | 119 --
.../attributes/V2/PlatformPropertyV2.java | 100 --
.../attributes/V2/package-info.java | 1 -
.../certificate/attributes/package-info.java | 1 -
.../userdefined/certificate/package-info.java | 1 -
.../entity/userdefined/info/FirmwareInfo.java | 60 -
.../entity/userdefined/info/HardwareInfo.java | 122 --
.../entity/userdefined/info/NetworkInfo.java | 113 --
.../entity/userdefined/info/OSInfo.java | 99 --
.../entity/userdefined/info/RIMInfo.java | 66 -
.../entity/userdefined/info/TPMInfo.java | 316 -----
.../entity/userdefined/package-info.java | 1 -
.../userdefined/report/DeviceInfoReport.java | 289 -----
.../result/CertificateValidationResult.java | 51 -
.../rim/BaseReferenceManifest.java | 390 ------
.../userdefined/rim/EventLogMeasurements.java | 67 -
.../rim/SupportReferenceManifest.java | 115 --
.../entity/userdefined/rim/package-info.java | 1 -
.../portal/persist/enums/AppraisalStatus.java | 106 --
.../portal/persist/enums/HealthStatus.java | 57 -
.../portal/persist/enums/Page.java | 182 ---
.../portal/persist/enums/package-info.java | 1 -
.../portal/persist/service/DbServiceImpl.java | 15 -
.../persist/service/DefaultService.java | 4 -
.../persist/service/DeviceServiceImpl.java | 49 -
.../service/ReferenceManifestServiceImpl.java | 71 --
.../persist/service/SettingsServiceImpl.java | 41 -
.../portal/persist/type/InetAddressType.java | 192 ---
.../persist/type/X509CertificateType.java | 203 ----
.../portal/portal/HIRSApplication.java | 28 -
.../portal/portal/HIRSDbInitializer.java | 63 -
.../portal/portal/PersistenceJPAConfig.java | 86 --
.../portal/datatables/DataTableResponse.java | 74 --
.../portal/portal/package-info.java | 4 -
.../portal/portal/page/PageController.java | 172 ---
.../portal/portal/page/PageMessages.java | 70 --
.../portal/portal/page/PageParams.java | 17 -
.../portal/portal/page/PolicyPageModel.java | 80 --
.../controllers/DevicePageController.java | 85 --
.../page/controllers/ErrorController.java | 23 -
.../page/controllers/IndexPageController.java | 40 -
.../controllers/PolicyPageController.java | 964 ---------------
.../portal/page/params/NoPageParams.java | 21 -
.../portal/utils/BannerConfiguration.java | 154 ---
.../portal/utils/BouncyCastleUtils.java | 49 -
.../attestationca/portal/utils/HexUtils.java | 115 --
.../attestationca/portal/utils/JsonUtils.java | 102 --
.../portal/utils/PCRQuoteValidator.java | 225 ----
.../portal/utils/StringValidator.java | 110 --
.../portal/utils/SwidResource.java | 84 --
.../portal/utils/VersionHelper.java | 57 -
.../portal/utils/digest/AbstractDigest.java | 247 ----
.../portal/utils/digest/Digest.java | 136 ---
.../portal/utils/digest/DigestAlgorithm.java | 66 -
.../digest/DigestComparisonResultType.java | 24 -
.../portal/utils/digest/OptionalDigest.java | 96 --
.../exception/PolicyManagerException.java | 45 -
.../tpm/TPMBaselineGeneratorException.java | 46 -
.../utils/tpm/eventlog/TCGEventLog.java | 350 ------
.../portal/utils/tpm/eventlog/TcgTpmtHa.java | 215 ----
.../utils/tpm/eventlog/TpmPcrEvent.java | 731 -----------
.../utils/tpm/eventlog/TpmPcrEvent1.java | 85 --
.../utils/tpm/eventlog/TpmPcrEvent2.java | 135 ---
.../tpm/eventlog/events/EvCompactHash.java | 59 -
.../tpm/eventlog/events/EvConstants.java | 166 ---
.../eventlog/events/EvEfiBootServicesApp.java | 132 --
.../eventlog/events/EvEfiGptPartition.java | 148 ---
.../eventlog/events/EvEfiHandoffTable.java | 142 ---
.../tpm/eventlog/events/EvEfiSpecIdEvent.java | 150 ---
.../utils/tpm/eventlog/events/EvEventTag.java | 68 --
.../utils/tpm/eventlog/events/EvIPL.java | 43 -
.../utils/tpm/eventlog/events/EvNoAction.java | 86 --
.../utils/tpm/eventlog/events/EvPostCode.java | 78 --
.../tpm/eventlog/events/EvSCrtmContents.java | 41 -
.../tpm/eventlog/events/EvSCrtmVersion.java | 63 -
.../tpm/eventlog/events/package-info.java | 6 -
.../utils/tpm/eventlog/package-info.java | 6 -
.../tpm/eventlog/uefi/UefiBootOrder.java | 41 -
.../tpm/eventlog/uefi/UefiBootVariable.java | 111 --
.../tpm/eventlog/uefi/UefiConstants.java | 274 -----
.../tpm/eventlog/uefi/UefiDevicePath.java | 488 --------
.../utils/tpm/eventlog/uefi/UefiFirmware.java | 75 --
.../utils/tpm/eventlog/uefi/UefiGuid.java | 193 ---
.../tpm/eventlog/uefi/UefiPartition.java | 93 --
.../tpm/eventlog/uefi/UefiSecureBoot.java | 57 -
.../tpm/eventlog/uefi/UefiSignatureData.java | 172 ---
.../tpm/eventlog/uefi/UefiSignatureList.java | 225 ----
.../utils/tpm/eventlog/uefi/UefiVariable.java | 204 ----
.../utils/tpm/eventlog/uefi/UefiX509Cert.java | 92 --
.../utils/tpm/eventlog/uefi/package-info.java | 6 -
.../portal/utils/tpm/package-info.java | 6 -
.../portal/utils/xjc/BaseElement.java | 105 --
.../utils/xjc/CanonicalizationMethodType.java | 109 --
.../portal/utils/xjc/DSAKeyValueType.java | 227 ----
.../portal/utils/xjc/DigestMethodType.java | 110 --
.../portal/utils/xjc/Directory.java | 86 --
.../portal/utils/xjc/Entity.java | 200 ---
.../portal/utils/xjc/Evidence.java | 98 --
.../attestationca/portal/utils/xjc/File.java | 96 --
.../portal/utils/xjc/FilesystemItem.java | 154 ---
.../portal/utils/xjc/KeyInfoType.java | 141 ---
.../portal/utils/xjc/KeyValueType.java | 91 --
.../attestationca/portal/utils/xjc/Link.java | 236 ----
.../portal/utils/xjc/ManifestType.java | 111 --
.../attestationca/portal/utils/xjc/Meta.java | 47 -
.../portal/utils/xjc/ObjectFactory.java | 723 -----------
.../portal/utils/xjc/ObjectType.java | 170 ---
.../portal/utils/xjc/Ownership.java | 85 --
.../portal/utils/xjc/PGPDataType.java | 104 --
.../portal/utils/xjc/Process.java | 96 --
.../portal/utils/xjc/RSAKeyValueType.java | 93 --
.../portal/utils/xjc/ReferenceType.java | 214 ----
.../portal/utils/xjc/Resource.java | 68 --
.../portal/utils/xjc/ResourceCollection.java | 95 --
.../portal/utils/xjc/RetrievalMethodType.java | 127 --
.../portal/utils/xjc/SPKIDataType.java | 82 --
.../portal/utils/xjc/SignatureMethodType.java | 114 --
.../utils/xjc/SignaturePropertiesType.java | 111 --
.../utils/xjc/SignaturePropertyType.java | 143 ---
.../portal/utils/xjc/SignatureType.java | 195 ---
.../portal/utils/xjc/SignatureValueType.java | 99 --
.../portal/utils/xjc/SignedInfoType.java | 167 ---
.../portal/utils/xjc/SoftwareIdentity.java | 374 ------
.../portal/utils/xjc/SoftwareMeta.java | 446 -------
.../portal/utils/xjc/TransformType.java | 115 --
.../portal/utils/xjc/TransformsType.java | 76 --
.../attestationca/portal/utils/xjc/Use.java | 82 --
.../portal/utils/xjc/X509DataType.java | 99 --
.../utils/xjc/X509IssuerSerialType.java | 98 --
.../src/main/resources/application.properties | 2 +-
.../src/main/resources/component-class.json | 477 --------
.../src/main/resources/vendor-table.json | 233 ----
.../src/main/webapp/WEB-INF/web.xml | 6 +
.../OrderedListQueryDataTableAdapterTest.java | 108 --
.../portal/page/datatables/package-info.java | 4 -
.../test/resources/certificates/badCert.pem | 1 -
.../test/resources/certificates/fakeCA.pem | 18 -
.../certificates/fakeIntelIntermediateCA.pem | 19 -
.../certificates/fakestmtpmekint02.pem | 22 -
.../certificates/sample_identity_cert.cer | Bin 786 -> 0 bytes
.../ab21ccf2-tpmcert.pem | 26 -
.../endorsement_credentials/tpmcert.pem | 26 -
.../platform_credentials/Intel_pc.cer | Bin 772 -> 0 bytes
.../platform_credentials/Intel_pc2.pem | Bin 914 -> 0 bytes
.../basic_plat_cert_2-0.pem | 42 -
.../pciids_plat_cert_2-0.pem | 37 -
.../test/resources/rims/generated_bad.swidtag | 12 -
.../resources/rims/generated_good.swidtag | 51 -
186 files changed, 15 insertions(+), 23929 deletions(-)
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/AbstractEntity.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Appraiser.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/ArchivableEntity.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Policy.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/UserDefinedEntity.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/manager/DeviceRepository.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/manager/ReferenceManifestRepository.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/manager/SettingsRepository.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/Certificate.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/Device.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/ReferenceDigestValue.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/ReferenceManifest.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/Report.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/SupplyChainSettings.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateVariables.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/ConformanceCredential.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/DeviceAssociatedCertificate.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/EndorsementCredential.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/IssuedAttestationCertificate.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/PlatformCredential.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/CommonCriteriaMeasures.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentAddress.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentClass.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentIdentifier.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/FIPSLevel.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformConfiguration.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformConfigurationV1.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformProperty.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TBBSecurityAssertion.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSecurityAssertions.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSpecification.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/URIReference.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/AttributeStatus.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/CertificateIdentifier.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/ComponentIdentifierV2.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/PlatformConfigurationV2.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/PlatformPropertyV2.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/FirmwareInfo.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/HardwareInfo.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/NetworkInfo.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/OSInfo.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/RIMInfo.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/TPMInfo.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/report/DeviceInfoReport.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/result/CertificateValidationResult.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/BaseReferenceManifest.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/EventLogMeasurements.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/SupportReferenceManifest.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/AppraisalStatus.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/HealthStatus.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/Page.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DbServiceImpl.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DefaultService.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DeviceServiceImpl.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/ReferenceManifestServiceImpl.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/SettingsServiceImpl.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/type/InetAddressType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/type/X509CertificateType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSApplication.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSDbInitializer.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/PersistenceJPAConfig.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/datatables/DataTableResponse.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/PageController.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/PageMessages.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/PageParams.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/PolicyPageModel.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/controllers/DevicePageController.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/controllers/ErrorController.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/controllers/IndexPageController.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/controllers/PolicyPageController.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/page/params/NoPageParams.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/BannerConfiguration.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/BouncyCastleUtils.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/HexUtils.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/JsonUtils.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/PCRQuoteValidator.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/StringValidator.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/SwidResource.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/VersionHelper.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/AbstractDigest.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/Digest.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestAlgorithm.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestComparisonResultType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/OptionalDigest.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/exception/PolicyManagerException.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/TPMBaselineGeneratorException.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TCGEventLog.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TcgTpmtHa.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent1.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent2.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvCompactHash.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvConstants.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiBootServicesApp.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiGptPartition.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiHandoffTable.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiSpecIdEvent.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEventTag.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvIPL.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvNoAction.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvPostCode.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmContents.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmVersion.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootOrder.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootVariable.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiConstants.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiDevicePath.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiFirmware.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiGuid.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiPartition.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSecureBoot.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureData.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureList.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiVariable.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiX509Cert.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/BaseElement.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/CanonicalizationMethodType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/DSAKeyValueType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/DigestMethodType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Directory.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Entity.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Evidence.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/File.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/FilesystemItem.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/KeyInfoType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/KeyValueType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Link.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/ManifestType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Meta.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/ObjectFactory.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/ObjectType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Ownership.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/PGPDataType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Process.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/RSAKeyValueType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/ReferenceType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Resource.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/ResourceCollection.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/RetrievalMethodType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SPKIDataType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SignatureMethodType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SignaturePropertiesType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SignaturePropertyType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SignatureType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SignatureValueType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SignedInfoType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SoftwareIdentity.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/SoftwareMeta.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/TransformType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/TransformsType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/Use.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/X509DataType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/xjc/X509IssuerSerialType.java
delete mode 100644 HIRS_AttestationCAPortal/src/main/resources/component-class.json
delete mode 100644 HIRS_AttestationCAPortal/src/main/resources/vendor-table.json
delete mode 100644 HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/datatables/OrderedListQueryDataTableAdapterTest.java
delete mode 100644 HIRS_AttestationCAPortal/src/test/java/hirs/attestationca/portal/page/datatables/package-info.java
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/certificates/badCert.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/certificates/fakeCA.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/certificates/fakeIntelIntermediateCA.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/certificates/fakestmtpmekint02.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/certificates/sample_identity_cert.cer
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/endorsement_credentials/ab21ccf2-tpmcert.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/endorsement_credentials/tpmcert.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/platform_credentials/Intel_pc.cer
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/platform_credentials/Intel_pc2.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/platform_credentials/basic_plat_cert_2-0.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/platform_credentials/pciids_plat_cert_2-0.pem
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/rims/generated_bad.swidtag
delete mode 100644 HIRS_AttestationCAPortal/src/test/resources/rims/generated_good.swidtag
diff --git a/HIRS_AttestationCAPortal/build.gradle b/HIRS_AttestationCAPortal/build.gradle
index 649cd8da..48af0696 100644
--- a/HIRS_AttestationCAPortal/build.gradle
+++ b/HIRS_AttestationCAPortal/build.gradle
@@ -25,29 +25,19 @@ repositories {
}
dependencies {
- jaxb "org.glassfish.jaxb:jaxb-xjc:4.0.1"
- jaxb "org.glassfish.jaxb:jaxb-runtime:4.0.1"
+ implementation project(':HIRS_Utils')
+ implementation project(':HIRS_AttestationCA')
+
+ implementation 'com.github.marandus:pci-ids:0.3'
+ implementation 'org.bouncycastle:bcmail-jdk15on:1.70'
+ implementation 'com.google.guava:guava:31.1-jre'
+ implementation 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.0'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.projectlombok:lombok'
- implementation 'org.bouncycastle:bcmail-jdk15on:1.70'
- implementation 'org.springframework.plugin:spring-plugin-core:3.0.0'
- implementation 'org.apache.httpcomponents:httpclient:4.5.7'
- implementation 'com.google.guava:guava:31.1-jre'
- implementation 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.0'
- implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
- implementation 'commons-codec:commons-codec:1.15'
- implementation 'org.apache.commons:commons-lang3:3.12.0'
- implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
- implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
- implementation 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
- implementation 'com.fasterxml.jackson.core:jackson-core:2.14.2'
- implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
- implementation "org.glassfish.jaxb:jaxb-runtime:4.0.1"
- implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
-// implementation 'com.sun.xml.bind:jaxb-impl:4.0.2' //creates duplicate error
+
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
annotationProcessor 'org.projectlombok:lombok'
@@ -63,34 +53,3 @@ war {
}
archiveFileName = 'HIRS_AttestationCAPortal.war'
}
-
-task generateXjcLibrary(type:Exec) {
- workingDir 'config'
-
- commandLine './genXjcLibrary.sh'
-}
-compileJava.dependsOn generateXjcLibrary
-
-//ospackage {
-// packageName = 'HIRS_AttestationCA'
-// os = LINUX
-// arch = NOARCH
-// release = '1'
-//
-// user 'root'
-// fileMode = 0755
-//
-// addParentDirs = true
-// createDirectoryEntry true
-//
-// into ("/opt/tomcat/webapps") {
-// from war.outputs.files
-// from '../HIRS_AttestationCAPortal/build/libs/HIRS_AttestationCAPortal.war'
-// user 'root'
-// fileMode = 0755
-// }
-//
-// buildRpm {
-// arch = X86_64
-// }
-//}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/AbstractEntity.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/AbstractEntity.java
deleted file mode 100644
index 68a9d0d9..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/AbstractEntity.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package hirs.attestationca.portal.persist.entity;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.MappedSuperclass;
-import lombok.Getter;
-import lombok.ToString;
-import org.hibernate.annotations.ColumnDefault;
-import org.hibernate.annotations.Generated;
-import org.hibernate.annotations.GenerationTime;
-import org.hibernate.annotations.JdbcTypeCode;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.UUID;
-
-/**
- * An abstract database entity.
- */
-@ToString
-@MappedSuperclass
-public abstract class AbstractEntity implements Serializable {
-
- /**
- * static value for the length of a status message for objects that
- * can have extremely long values, potentially.
- */
- protected static final int RESULT_MESSAGE_LENGTH = 1000000;
-
- @Id
- @Column(name = "id")
- @GeneratedValue(generator = "uuid2", strategy=GenerationType.AUTO)
- @JdbcTypeCode(java.sql.Types.VARCHAR)
- @Getter
- private UUID id;
-
- @Column (name = "create_time")
- @ColumnDefault(value = "CURRENT_TIMESTAMP")
- @Generated(GenerationTime.INSERT)
- private Date createTime;// = new Date();
-
- /**
- * Default empty constructor is required for Hibernate. It is protected to
- * prevent code from calling it directly.
- */
- protected AbstractEntity() {
- super();
- }
-
- /**
- * Setter for the UUID that can not be null
- * and can not be overridden.
- * @param id - primary able key
- */
- public void setId(UUID id) {
- if (id != null) {
- this.id = id;
- }
- }
-
- /**
- * Returns the creation time of this entity.
- *
- * @return creation time
- */
- public Date getCreateTime() {
- return (Date) createTime.clone();
- }
-
- /**
- * Reset the creation time to the current time.
- */
- public void resetCreateTime() {
- createTime.setTime(new Date().getTime());
- }
-
- @Override
- public int hashCode() {
- if (id != null) {
- return id.hashCode();
- }
- return super.hashCode();
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(this.getClass().equals(obj.getClass()))) {
- return false;
- }
- return this.hashCode() == obj.hashCode();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Appraiser.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Appraiser.java
deleted file mode 100644
index 13c55d67..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Appraiser.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package hirs.attestationca.portal.persist.entity;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
-import lombok.AccessLevel;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * The Appraiser
class represents an appraiser that can appraise a Report
.
- * Appraiser
s are invoked to validate the integrity of client's platform. An
- * Appraiser
does this by examining a Report
sent from the client's
- * machine.
- *
- * Supported Report
types are kept track of in three ways:
DeviceInfoAppraiser
- * takes in a DeviceInfoReport
and the TPMAppraiser
takes in an
- * IntegrityReport
)IMAAppraiser
requests an IMAReport
and the
- * TPMAppraiser
requests a TPMReport
)IntegrityReport
then the IMAAppraiser
needs to
- * extract both a DeviceInfoReport
and a IMAReport
from the
- * IntegrityReport
)TPMAppraiser
.
- */
- public static final String TPM_NAME = "TPM Appraiser";
- /**
- * Name set for every instance of SupplyChainAppraiser
.
- */
- public static final String SC_NAME = "Supply Chain Appraiser";
- /**
- * Name set for every instance of IMAAppraiser
.
- */
- public static final String IMA_NAME = "IMA Appraiser";
- /**
- * Name set for every instance of HIRSAppraiser
.
- */
- public static final String HIRS_NAME = "HIRS Appraiser";
- /**
- * Name set for every instance of DeviceInfoAppraiser
.
- */
- public static final String DI_NAME = "Device Info Appraiser";
-
- @Getter
- @ToString.Exclude
- @EqualsAndHashCode.Exclude
- @Id
- @Column(name = "Appraiser_ID")
- @GeneratedValue(strategy = GenerationType.AUTO)
- private Long id;
-
- @Getter
- @Setter
- @Column(nullable = false, unique = true)
- private String name;
-
- /**
- * Creates a new Appraiser
with the specified name. The name should be universally
- * unique as this is how other components will identify Appraiser
s. Web portals,
- * for instance, could display a list of Appraiser
names to display which
- * Appraiser
s are available.
- *
- * The name will be tested for uniqueness when it is added to a repository. It is not tested for
- * uniqueness in the class.
- *
- * @param name unique name
- */
- public Appraiser(final String name) {
- this.name = name;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/ArchivableEntity.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/ArchivableEntity.java
deleted file mode 100644
index 26b5f4a2..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/ArchivableEntity.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package hirs.attestationca.portal.persist.entity;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.MappedSuperclass;
-import lombok.Getter;
-import lombok.ToString;
-
-import java.util.Date;
-
-/**
- * An abstract archivable entity that can be deleted.
- */
-@ToString
-@Getter
-@MappedSuperclass
-public abstract class ArchivableEntity extends AbstractEntity {
-
- /**
- * Defining the size of a message field for error display.
- */
- public static final int MAX_MESSAGE_LENGTH = 2400;
-
- @Column(name = "archived_time")
- private Date archivedTime;
-
- @Column(name = "archived_description")
- private String archivedDescription;
-
- /**
- * Default empty constructor is required for Hibernate. It is protected to
- * prevent code from calling it directly.
- */
- protected ArchivableEntity() {
- super();
- }
-
- /**
- * Return the boolean representing whether or not this entity has been soft-deleted.
- *
- * @return true if this entity has been soft-deleted, false otherwise
- */
- public final boolean isArchived() {
- return archivedTime != null;
- }
-
- /**
- * Signals that this entity has been archived, by setting the archivedTime to the current date
- * and time.
- *
- * @return
- * true if time was null and date was set.
- * false is archived time is already set, signifying the entity has been archived.
- */
- public final boolean archive() {
- if (this.archivedTime == null) {
- this.archivedTime = new Date();
- return true;
- }
- return false;
- }
-
- /**
- * Sets a description for the resolution if one is provided. This is done for accounting
- * purposes so the reason for action taken can be referenced.
- *
- * @param description - description of the action taken for resolution
- * @return
- * boolean result is dependent on the return value of the archive() method
- */
- public final boolean archive(final String description) {
- if (archive()) {
- this.archivedDescription = description;
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Sets the archivedTime to null. The archivedTime being null signifies that the entity has
- * not been archived. If the time is already null then this call was unnecessary.
- *
- * @return
- * true if the time is changed to null.
- * false if time was already set to null.
- */
- public final boolean restore() {
- if (this.archivedTime != null) {
- this.archivedTime = null;
- this.archivedDescription = null;
- return true;
- }
- return false;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Policy.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Policy.java
deleted file mode 100644
index c10079e3..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/Policy.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package hirs.attestationca.portal.persist.entity;
-
-import jakarta.persistence.Access;
-import jakarta.persistence.AccessType;
-import jakarta.persistence.Inheritance;
-import jakarta.persistence.InheritanceType;
-import jakarta.persistence.MappedSuperclass;
-
-/**
- * The
- * This
- * This class parses the associated component identifier located in Platform
- * Certificates and maps them to the corresponding string representation found
- * in the associated JSON file. If the value can not be found, either because
- * the provided value is malformed or doesn't exist in the mapping, then values
- * returned will not match what is expected. This class will return Unknown as a
- * category and None as the component which is not a valid mapping. This is
- * because None is a category and Unknown is a component identifier.
- * PageParams class used by the subclass.
- */
-@AllArgsConstructor
-public abstract class PageController {
-
- private static final Logger LOGGER = LogManager.getLogger(PageController.class);
-
- /**
- * Model attribute name used by initPage for the initial data passed to the page.
- */
- public static final String INITIAL_DATA = "initialData";
-
- /**
- * Reserved attribute used by page.tag to identify a page's general
- * information.
- */
- public static final String PAGE_ATTRIBUTE = "page";
-
- /**
- * Reserved attribute used by page.tag to identify the page collection used
- * for navigation.
- */
- public static final String PAGES_ATTRIBUTE = "pages";
-
- /**
- * Reserved attribute used by page.tag to identify the banner information.
- */
- public static final String BANNER_ATTRIBUTE = "banner";
-
- /**
- * Reserved attribute used by page.tag to identify the messages the page
- * should display.
- */
- public static final String MESSAGES_ATTRIBUTE = "messages";
-
- private final Page page;
-
- /**
- * 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.
- */
- @RequestMapping
- public abstract ModelAndView initPage(@ModelAttribute P params, Model model);
-
- /**
- * Creates a generic ModelAndView containing this page's configuration and
- * the list of other pages for navigational purposes.
- *
- * @return A generic ModelAndView containing basic information for the page.
- */
- protected final ModelAndView getBaseModelAndView() {
- return getBaseModelAndView(page);
- }
-
- /**
- * Creates a generic ModelAndView containing the specify page
- * configuration and the list of other pages for navigational
- * purposes.
- *
- * @param newPage new page to get the model and view
- * @return A generic ModelAndView containing basic information for the page.
- */
- protected final ModelAndView getBaseModelAndView(final Page newPage) {
- ModelMap modelMap = new ExtendedModelMap();
-
- // add page information
- modelMap.addAttribute(PAGE_ATTRIBUTE, newPage);
-
- // add other pages for navigation
- modelMap.addAttribute(PAGES_ATTRIBUTE, Page.values());
-
- // add banner information
- try {
- BannerConfiguration banner = new BannerConfiguration();
- modelMap.addAttribute(BANNER_ATTRIBUTE, banner);
- } catch (IOException ex) {
- modelMap.addAttribute(BANNER_ATTRIBUTE, null);
- }
-
- return new ModelAndView(newPage.getViewName(), modelMap);
- }
-
- /**
- * Redirects back to this controller's page with the specified data.
- *
- * @param params The url parameters to pass to the page.
- * @param model The model data to pass to the page.
- * @param attr The request's RedirectAttributes to hold the model data.
- * @return RedirectView back to the page with the specified parameters.
- * @throws java.net.URISyntaxException if malformed URI
- */
- protected final RedirectView redirectToSelf(
- final P params,
- final Map
- * Two classes were made to facilitate persisting them with Hibernate in different ways.
- * To persist non-nullable entries in an embedded collection, use {@link main.java.hirs.attestationca.utils.digest.Digest} (see
- * {@link TPMBaseline} for reference.) To persist nullable entries, use {@link main.java.hirs.attestationca.utils.digest.OptionalDigest}
- * (see {@link ImaBlacklistRecord} for reference.)
- */
-public abstract class AbstractDigest {
- private static final org.apache.logging.log4j.Logger LOGGER =
- LogManager.getLogger(AbstractDigest.class);
- /**
- * Length of MD2 digest.
- */
- public static final int MD2_DIGEST_LENGTH = 16;
- /**
- * Length of MD5 digest.
- */
- public static final int MD5_DIGEST_LENGTH = 16;
- /**
- * Length of SHA1 digest.
- */
- public static final int SHA1_DIGEST_LENGTH = 20;
- /**
- * Length of SHA256 digest.
- */
- public static final int SHA256_DIGEST_LENGTH = 32;
- /**
- * Length of SHA384 digest.
- */
- public static final int SHA384_DIGEST_LENGTH = 48;
- /**
- * Length of SHA512 digest.
- */
- public static final int SHA512_DIGEST_LENGTH = 64;
-
- /**
- * Ensures the given algorithm type and digest byte array represent a valid digest.
- * This includes ensuring they are both not null or empty and ensuring that the length of the
- * digest matches the expected amount of data for the given algorithm.
- *
- * @param algorithm a digest algorithm
- * @param digest the digest computed by this algorithm
- * @throws IllegalArgumentException if the provided input does not represent a valid digest
- */
- void validateInput(final DigestAlgorithm algorithm, final byte[] digest)
- throws IllegalArgumentException {
- if (algorithm == null) {
- throw new IllegalArgumentException("Algorithm must not be null");
- }
-
- if (ArrayUtils.isEmpty(digest)) {
- throw new IllegalArgumentException("Digest must have at least one byte");
- }
-
- if (digest.length != algorithm.getLengthInBytes()) {
- throw new IllegalDigestLength(algorithm, digest);
- }
- }
-
- /**
- * This method will help class determine the algorithm associated with the
- * pcr values given.
- *
- * @param digest list of pcr values.
- * @return the associated algorithm.
- */
- public static final DigestAlgorithm getDigestAlgorithm(final byte[] digest) {
- if (digest == null || ArrayUtils.isEmpty(digest)) {
- return DigestAlgorithm.UNSPECIFIED;
- }
-
- switch (digest.length) {
- case MD2_DIGEST_LENGTH:
- return DigestAlgorithm.MD5;
- case SHA1_DIGEST_LENGTH:
- return DigestAlgorithm.SHA1;
- case SHA256_DIGEST_LENGTH:
- return DigestAlgorithm.SHA256;
- case SHA384_DIGEST_LENGTH:
- return DigestAlgorithm.SHA384;
- case SHA512_DIGEST_LENGTH:
- return DigestAlgorithm.SHA512;
- default:
- return DigestAlgorithm.UNSPECIFIED;
- }
- }
-
- /**
- * This method will help class determine the algorithm associated with the
- * pcr values given.
- *
- * @param digest list of pcr values.
- * @return the associated algorithm.
- */
- public static final DigestAlgorithm getDigestAlgorithm(final String digest) {
- try {
- return getDigestAlgorithm(Hex.decodeHex(digest.toCharArray()));
- } catch (Exception deEx) {
- LOGGER.error(deEx);
- }
-
- return DigestAlgorithm.UNSPECIFIED;
- }
-
- /**
- * Retrieves the
- * This class differs from Java's provided
- * typedef struct {
- * TPMI_ALG_HASH hashAlg;
- * TPMU_HA digest;
- * } TPMT_HA;
- */
-public class TcgTpmtHa {
- /**
- * TCG Defined Algorithm Identifiers.
- */
- @Getter
- private int hashAlgId = 0;
- /**
- * Length of the hash.
- */
- @Getter
- private int hashLength = 0;
- /**
- * Human readable name of the hash algorithm.
- */
- @Getter
- private String hashName = "";
- /**
- * Hash data.
- */
- @Getter(value = AccessLevel.PROTECTED)
- private byte[] digest = null;
- /**
- * TCG ID for SHA1.
- */
- public static final int TPM_ALG_SHA1 = 0x04;
- /**
- * TCG ID for SHA1.
- */
- public static final int TPM_ALG_SHA256 = 0x0B;
- /**
- * TCG ID for SHA 384.
- */
- public static final int TPM_ALG_SHA384 = 0x0C;
- /**
- * TCG ID for SHA512.
- */
- public static final int TPM_ALG_SHA_512 = 0x0D;
- /**
- * TCG ID for Null algorithm.
- */
- public static final int TPM_ALG_NULL = 0x10;
- /**
- * TCG ID for SHA1.
- */
- public static final int TPM_ALG_SHA1_LENGTH = 20;
- /**
- * TCG ID for SHA1.
- */
- public static final int TPM_ALG_SHA256_LENGTH = 32;
- /**
- * TCG ID for SHA 384.
- */
- public static final int TPM_ALG_SHA384_LENGTH = 48;
- /**
- * TCG ID for SHA512.
- */
- public static final int TPM_ALG_SHA512_LENGTH = 64;
- /**
- * TCG ID for Null algorithm.
- */
- public static final int TPM_ALG_NULL_LENGTH = 0;
- /**
- * buffer to hold the structure.
- */
- private byte[] buffer = null;
-
- /**
- * Constructor.
- *
- * @param is ByteArrayInputStream holding the TcgTPMT_HA structured data
- * @throws java.io.IOException if TPMT_HA structure cannot be parsed
- */
- public TcgTpmtHa(final ByteArrayInputStream is) throws IOException {
- byte[] algID = new byte[2];
- is.read(algID);
- byte[] rAlgID = HexUtils.leReverseByte(algID);
- hashAlgId = new BigInteger(rAlgID).intValue();
- hashName = tcgAlgIdToString(algID[0]);
- hashLength = tcgAlgLength(algID[0]);
- digest = new byte[hashLength];
- is.read(digest);
- buffer = new byte[algID.length + digest.length];
- System.arraycopy(algID, 0, buffer, 0, algID.length);
- System.arraycopy(digest, 0, buffer, algID.length, digest.length);
- }
-
- /**
- * Returns the contents of the TPMT_HA structure buffer.
- *
- * @return contents of the TPMT_HA structure.
- */
- public byte[] getBuffer() {
- return java.util.Arrays.copyOf(buffer, buffer.length);
- }
-
- /**
- * Readable description of the Algorithm.
- *
- * @return Readable Algorithm name
- */
- @Override
- public String toString() {
- return String.format("%s hash = %s", hashName, HexUtils.byteArrayToHexString(digest));
- }
-
- /**
- * Returns the hash name via a lookup.
- * Lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document.
- * Only hash algorithms found in Table 7 are used.
- *
- * @param algId int to convert to string
- * @return name of the algorithm
- */
- public static String tcgAlgIdToString(final int algId) {
- String alg;
- switch (algId) {
- case TPM_ALG_SHA1:
- alg = "TPM_ALG_SHA1";
- break;
- case TPM_ALG_SHA256:
- alg = "TPM_ALG_SHA256";
- break;
- case TPM_ALG_SHA384:
- alg = "TPM_ALG_SHA384";
- break;
- case TPM_ALG_SHA_512:
- alg = "TPM_ALG_SHA512";
- break;
- case TPM_ALG_NULL:
- alg = "TPM_ALG_NULL";
- break;
- default:
- alg = "Unknown or invalid Hash";
- }
- return alg;
- }
-
- /**
- * Returns the TCG defined ID via a lookup o the TCG Defined Algorithm String.
- * Lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document.
- * Only hash algorithms found in Table 7 are used.
- *
- * @param algorithm String to convert to an id
- * @return id of hash algorithm
- */
- public static int tcgAlgStringToId(final String algorithm) {
- int alg;
- switch (algorithm) {
- case "TPM_ALG_SHA1":
- alg = TPM_ALG_SHA1;
- break;
- case "TPM_ALG_SHA256":
- alg = TPM_ALG_SHA256;
- break;
- case "TPM_ALG_SHA384":
- alg = TPM_ALG_SHA384;
- break;
- case "TPM_ALG_SHA512":
- alg = TPM_ALG_SHA_512;
- break;
- case "TPM_ALG_NULL":
- default:
- alg = TPM_ALG_NULL;
- }
- return alg;
- }
-
- /**
- * Sets the length of a given TPM ALG Identifier.
- * (lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document)
- * Only hash algorithms found in Table 7 are used.
- *
- * @param algId TCG defined Algorithm identifier
- * @return length of hash data in bytes
- */
- public static int tcgAlgLength(final int algId) {
- int length;
- switch (algId) {
- case TPM_ALG_SHA1:
- length = TPM_ALG_SHA1_LENGTH;
- break;
- case TPM_ALG_SHA256:
- length = TPM_ALG_SHA256_LENGTH;
- break;
- case TPM_ALG_SHA384:
- length = TPM_ALG_SHA384_LENGTH;
- break;
- case TPM_ALG_SHA_512:
- length = TPM_ALG_SHA512_LENGTH;
- break;
- case TPM_ALG_NULL:
- default:
- length = TPM_ALG_NULL_LENGTH;
- }
- return length;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent.java
deleted file mode 100644
index b7ab0db2..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent.java
+++ /dev/null
@@ -1,731 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog;
-
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.tpm.eventlog.events.EvCompactHash;
-import hirs.attestationca.utils.tpm.eventlog.events.EvConstants;
-import hirs.attestationca.utils.tpm.eventlog.events.EvEfiGptPartition;
-import hirs.attestationca.utils.tpm.eventlog.events.EvEfiHandoffTable;
-import hirs.attestationca.utils.tpm.eventlog.events.EvEfiSpecIdEvent;
-import hirs.attestationca.utils.tpm.eventlog.events.EvEventTag;
-import hirs.attestationca.utils.tpm.eventlog.events.EvIPL;
-import hirs.attestationca.utils.tpm.eventlog.events.EvNoAction;
-import hirs.attestationca.utils.tpm.eventlog.events.EvSCrtmContents;
-import hirs.attestationca.utils.tpm.eventlog.events.EvSCrtmVersion;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiConstants;
-import hirs.attestationca.utils.tpm.eventlog.events.EvEfiBootServicesApp;
-import hirs.attestationca.utils.tpm.eventlog.events.EvPostCode;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiFirmware;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiVariable;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.commons.codec.binary.Hex;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.math.BigInteger;
-import java.nio.charset.StandardCharsets;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.util.Arrays;
-
-/**
- * Class to process a TCG_PCR_EVENT.
- * TCG_PCR_EVENT is used when the Event log uses the SHA1 Format as described in the
- * TCG Platform Firmware Profile (PFP) specification.
- * typedef struct {
- * TCG_PCRINDEX PCRIndex; //PCR Index value that either
- * //matches the PCRIndex of a
- * //previous extend operation or
- * //indicates that this Event Log
- * //entry is not associated with
- * //an extend operation
- * TCG_EVENTTYPE EventType; //See Log event types defined in toStrng()
- * TCG_DIGEST digest; //The hash of the event data
- * UINT32 EventSize; //Size of the event data
- * UINT8 Event[EventSize]; //The event data
- * } TCG_PCR_EVENT;
- */
-public class TpmPcrEvent {
- private static final Logger LOGGER = LogManager.getLogger(TpmPcrEvent.class);
- /**
- * Indent Offset.
- */
- private static final int INDENT_3 = 3;
- /**
- * Log format. SHA1=1, Crytpo agile=2.
- * this can be refactored out
- */
- @Getter @Setter(value = AccessLevel.PROTECTED)
- private int logFormat = -1;
- /**
- * PCR index.
- */
- @Getter
- private int pcrIndex = -1;
- /**
- * Event Type (long).
- */
- @Getter
- private long eventType = 0;
- /**
- * Event digest.
- */
- private byte[] digest = null;
- /**
- * Event data (no content).
- */
- private byte[] event;
- /**
- * Event content data.
- */
- private byte[] eventContent;
- /**
- * TCG Event Log spec version.
- */
- @Getter
- private String specVersion = "Unknown";
- /**
- * TCG Event Log errata version.
- */
- @Getter
- private String specErrataVersion = "Unknown";
- /**
- * Description for toString support.
- */
- private String description = "";
- /**
- * Length (in bytes) of a pcr.
- */
- @Setter @Getter
- private int digestLength = 0;
- /**
- * Event hash for SHA1 event logs.
- */
- private byte[] eventDataSha1hash;
- /**
- * Event hash for Crypto Agile events.
- */
- private byte[] eventDataSha256hash;
- private EvPostCode evPostCode;
- @Setter @Getter
- private int eventNumber;
- @Setter @Getter
- private boolean error = false;
-
- /**
- * Constructor.
- *
- * @param is ByteArrayInputStream holding the event
- * @throws java.io.IOException when event can't be parsed
- */
- public TpmPcrEvent(final ByteArrayInputStream is) throws IOException {
-
- }
-
- /**
- * Sets the digest from a TCG_PCR_EVENT digest field.
- * This can be SHA1 for older event structures or any algorithm for newer structure.
- *
- * @param digestData cryptographic hash
- * @param digestLength length of the cryptographic hash
- */
- protected void setEventDigest(final byte[] digestData, final int digestLength) {
- digest = new byte[digestLength];
- System.arraycopy(digestData, 0, digest, 0, digestLength);
- }
-
- /**
- * Retrieves the digest from a TCG Event.
- * This can be SHA1 for older event structures or any algorithm for newer structure.
- *
- * @return the digest data for the event
- */
- public byte[] getEventDigest() {
- byte[] digestCopy = new byte[digestLength];
- System.arraycopy(digest, 0, digestCopy, 0, this.digestLength);
- return digestCopy;
- }
-
- /**
- * Returns a hex representation of the event digest.
- * @return hex string
- */
- public String getEventDigestStr() {
- return Hex.encodeHexString(this.digest);
- }
-
- /**
- * Sets the event PCR index value from a TCG Event.
- *
- * @param eventIndex TCG Event PCR Index as defined in the PFP
- */
- protected void setPcrIndex(final byte[] eventIndex) {
- pcrIndex = HexUtils.leReverseInt(eventIndex);
- }
-
- /**
- * Sets the EventType.
- *
- * @param type byte array holding the PFP defined log event type
- */
- protected void setEventType(final byte[] type) {
- eventType = new BigInteger(1, HexUtils.leReverseByte(type)).longValue();
- }
-
- /**
- * Returns a formatted string of the type for the event.
- * @return a string formatted to be human readable
- */
- public String getEventTypeStr() {
- return String.format("0x%s %s", Long.toHexString(eventType), eventString((int) eventType));
- }
-
- /**
- * Returns a formatted string of the type for the event minus the byte code.
- * @return a string formatted to be human readable
- */
- public String getEventTypeString() {
- return eventString((int) eventType);
- }
-
- /**
- * Sets the event data after processing.
- *
- * @param eventData The PFP defined event content
- */
- protected void setEventData(final byte[] eventData) {
- event = new byte[eventData.length];
- System.arraycopy(eventData, 0, event, 0, eventData.length);
- }
-
- /**
- * Gets the Event Data (no event content) for the event.
- * event log format.
- *
- * @return byte array holding the event structure.
- */
- public byte[] getEvent() {
- return Arrays.copyOf(event, event.length);
- }
-
- /**
- * Sets the event content after processing.
- *
- * @param eventData The PFP defined event content
- */
- protected void setEventContent(final byte[] eventData) {
- eventContent = new byte[eventData.length];
- evPostCode = new EvPostCode(eventContent);
- System.arraycopy(eventData, 0, eventContent, 0, eventData.length);
- }
-
- /**
- * Gets the event Content Data (not the entire event structure).
- *
- * @return byte array holding the events content field
- */
- public byte[] getEventContent() {
- return Arrays.copyOf(eventContent, eventContent.length);
- }
-
- /**
- * A getter that parses the content based on the type and returns the proper string
- * value for the content.
- * @return an appended string of human readable data
- */
- public String getEventContentStr() {
- StringBuilder sb = new StringBuilder();
-
- switch ((int) this.eventType) {
- case EvConstants.EV_PREBOOT_CERT:
- sb.append(" EV_PREBOOT_CERT");
- break;
- case EvConstants.EV_POST_CODE:
- sb.append(new EvPostCode(eventContent).toString());
- break;
- case EvConstants.EV_UNUSED:
- break;
- case EvConstants.EV_NO_ACTION:
- EvNoAction noAction = null;
- try {
- noAction = new EvNoAction(eventContent);
- sb.append(noAction.toString());
- if (noAction.isSpecIDEvent()) {
- // this should be in the constructor
- EvEfiSpecIdEvent specID = noAction.getSpecIDEvent();
- specVersion = String.format("%s.%s",
- specID.getVersionMajor(),
- specID.getVersionMinor());
- specErrataVersion = specID.getErrata();
- }
- } catch (UnsupportedEncodingException ueEx) {
- LOGGER.error(ueEx);
- sb.append(ueEx.toString());
- }
- break;
- case EvConstants.EV_SEPARATOR:
- if (EvPostCode.isAscii(eventContent)
- && !this.isBlank(eventContent)) {
- sb.append(String.format("Separator event content = %s",
- new String(eventContent, StandardCharsets.UTF_8)));
- }
- break;
- case EvConstants.EV_EVENT_TAG:
- sb.append(new EvEventTag(eventContent).toString());
- break;
- case EvConstants.EV_S_CRTM_CONTENTS:
- sb.append(new EvSCrtmContents(eventContent).toString());
- break;
- case EvConstants.EV_S_CRTM_VERSION:
- try {
- sb.append(new EvSCrtmVersion(eventContent).toString());
- } catch (UnsupportedEncodingException ueEx) {
- LOGGER.error(ueEx);
- sb.append(ueEx.toString());
- }
- break;
- case EvConstants.EV_CPU_MICROCODE:
- case EvConstants.EV_PLATFORM_CONFIG_FLAGS:
- case EvConstants.EV_TABLE_OF_DEVICES:
- break;
- case EvConstants.EV_COMPACT_HASH:
- try {
- sb.append(new EvCompactHash(eventContent).toString());
- } catch (UnsupportedEncodingException ueEx) {
- LOGGER.error(ueEx);
- sb.append(ueEx.toString());
- }
- break;
- case EvConstants.EV_IPL:
- sb.append(new EvIPL(eventContent).toString());
- break;
- case EvConstants.EV_IPL_PARTITION_DATA:
- case EvConstants.EV_NONHOST_CODE:
- case EvConstants.EV_NONHOST_CONFIG:
- case EvConstants.EV_NONHOST_INFO:
- case EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS:
- case EvConstants.EV_EFI_EVENT_BASE:
- break;
- case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
- UefiVariable efiVar = null;
- try {
- efiVar = new UefiVariable(eventContent);
- String efiVarDescription = efiVar.toString().replace("\n", "\n ");
- sb.append(efiVarDescription.substring(0,
- efiVarDescription.length() - INDENT_3));
- } catch (CertificateException cEx) {
- LOGGER.error(cEx);
- sb.append(cEx.toString());
- } catch (NoSuchAlgorithmException noSaEx) {
- LOGGER.error(noSaEx);
- sb.append(noSaEx.toString());
- } catch (IOException ioEx) {
- LOGGER.error(ioEx);
- sb.append(ioEx.toString());
- }
- break;
- case EvConstants.EV_EFI_VARIABLE_BOOT:
- case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
- try {
- sb.append(new UefiVariable(eventContent).toString());
- } catch (CertificateException cEx) {
- LOGGER.error(cEx);
- sb.append(cEx.toString());
- } catch (NoSuchAlgorithmException noSaEx) {
- LOGGER.error(noSaEx);
- sb.append(noSaEx.toString());
- } catch (IOException ioEx) {
- LOGGER.error(ioEx);
- sb.append(ioEx.toString());
- }
- break;
- case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
- case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER: // same as EV_EFI_BOOT_SERVICES_APP
- try {
- sb.append(new EvEfiBootServicesApp(eventContent).toString());
- } catch (UnsupportedEncodingException ueEx) {
- LOGGER.error(ueEx);
- sb.append(ueEx.toString());
- }
- break;
- case EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER:
- break;
- case EvConstants.EV_EFI_GPT_EVENT:
- try {
- sb.append(new EvEfiGptPartition(eventContent).toString());
- } catch (UnsupportedEncodingException ueEx) {
- LOGGER.error(ueEx);
- sb.append(ueEx.toString());
- }
- break;
- case EvConstants.EV_EFI_ACTION:
- case EvConstants.EV_ACTION:
- sb.append(new String(eventContent, StandardCharsets.UTF_8));
- break;
- case EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB:
- sb.append(new UefiFirmware(eventContent).toString());
- break;
- case EvConstants.EV_EFI_HANDOFF_TABLES:
- sb.append(new EvEfiHandoffTable(eventContent).toString());
- break;
- case EvConstants.EV_EFI_HCRTM_EVENT:
- break;
- default:
- sb.append("Unknown Event found\n");
- }
-
- return cleanTextContent(sb.toString());
- }
-
- /**
- * Parses the event content and creates a human readable description of each event.
- *
- * @param event the byte array holding the event data.
- * @param eventContent the byte array holding the event content.
- * @param eventNumber event position within the event log.
- * @param hashName name of the hash algorithm used by the event log
- * @return String description of the event.
- * @throws java.security.cert.CertificateException if the event contains an event that cannot be processed.
- * @throws java.security.NoSuchAlgorithmException if an event contains an unsupported algorithm.
- * @throws java.io.IOException if the event cannot be parsed.
- */
- public String processEvent(final byte[] event, final byte[] eventContent, final int eventNumber,
- final String hashName)
- throws CertificateException, NoSuchAlgorithmException, IOException {
- int eventID = (int) eventType;
- this.eventNumber = eventNumber;
- description += "Event# " + eventNumber + ": ";
- description += "Index PCR[" + getPcrIndex() + "]\n";
- description += "Event Type: 0x" + Long.toHexString(eventType) + " " + eventString(eventID);
- description += "\n";
- if (hashName.compareToIgnoreCase("TPM_ALG_SHA1") == 0) { // Digest
- description += "digest (SHA-1): " + Hex.encodeHexString(this.digest);
- } else if (hashName.compareToIgnoreCase("TPM_ALG_SHA256") == 0) { // Digest
- description += "digest (SHA256): " + Hex.encodeHexString(this.digest);
- } else if (hashName.compareToIgnoreCase("TPM_ALG_SHA384") == 0) { // Digest
- description += "digest (SHA384): " + Hex.encodeHexString(this.digest);
- } else if (hashName.compareToIgnoreCase("TPM_ALG_SHA512") == 0) { // Digest
- description += "digest (SHA512): " + Hex.encodeHexString(this.digest);
- } else {
- description += "Unsupported Hash Algorithm encoutered";
- }
- if (eventID != UefiConstants.SIZE_4) {
- description += "\n";
- }
- // Calculate both the SHA1 and SHA256 on the event since this will equal the digest
- // field of about half the log messages.
- MessageDigest md1 = MessageDigest.getInstance("SHA-1");
- md1.update(event);
- eventDataSha1hash = md1.digest();
- MessageDigest md2 = MessageDigest.getInstance("SHA-256");
- md2.update(event);
- eventDataSha256hash = md2.digest();
-
- switch (eventID) {
- case EvConstants.EV_PREBOOT_CERT:
- description += " EV_PREBOOT_CERT" + "\n";
- break;
- case EvConstants.EV_POST_CODE:
- EvPostCode postCode = new EvPostCode(eventContent);
- description += "Event Content:\n" + postCode.toString();
- break;
- case EvConstants.EV_UNUSED:
- break;
- case EvConstants.EV_NO_ACTION:
- EvNoAction noAction = new EvNoAction(eventContent);
- description += "Event Content:\n" + noAction.toString();
- if (noAction.isSpecIDEvent()) {
- EvEfiSpecIdEvent specID = noAction.getSpecIDEvent();
- specVersion = specID.getVersionMajor() + "." + specID.getVersionMinor();
- specErrataVersion = specID.getErrata();
- }
- break;
- case EvConstants.EV_SEPARATOR:
- if (EvPostCode.isAscii(eventContent)) {
- String separatorEventData = new String(eventContent, StandardCharsets.UTF_8);
- if (!this.isBlank(eventContent)) {
- description += "Separator event content = " + separatorEventData;
- }
- }
- break;
- case EvConstants.EV_ACTION:
- description += "Event Content:\n"
- + new String(eventContent, StandardCharsets.UTF_8);
- break;
- case EvConstants.EV_EVENT_TAG:
- EvEventTag eventTag = new EvEventTag(eventContent);
- description += eventTag.toString();
- break;
- case EvConstants.EV_S_CRTM_CONTENTS:
- EvSCrtmContents sCrtmContents = new EvSCrtmContents(eventContent);
- description += "Event Content:\n " + sCrtmContents.toString();
- break;
- case EvConstants.EV_S_CRTM_VERSION:
- EvSCrtmVersion sCrtmVersion = new EvSCrtmVersion(eventContent);
- description += "Event Content:\n" + sCrtmVersion.toString();
- break;
- case EvConstants.EV_CPU_MICROCODE:
- break;
- case EvConstants.EV_PLATFORM_CONFIG_FLAGS:
- break;
- case EvConstants.EV_TABLE_OF_DEVICES:
- break;
- case EvConstants.EV_COMPACT_HASH:
- EvCompactHash compactHash = new EvCompactHash(eventContent);
- description += "Event Content:\n" + compactHash.toString();
- break;
- case EvConstants.EV_IPL:
- EvIPL ipl = new EvIPL(eventContent);
- description += "Event Content:\n" + ipl.toString();
- break;
- case EvConstants.EV_IPL_PARTITION_DATA:
- break;
- case EvConstants.EV_NONHOST_CODE:
- break;
- case EvConstants.EV_NONHOST_CONFIG:
- break;
- case EvConstants.EV_NONHOST_INFO:
- break;
- case EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS:
- break;
- case EvConstants.EV_EFI_EVENT_BASE:
- break;
- case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
- UefiVariable efiVar = new UefiVariable(eventContent);
- String efiVarDescription = efiVar.toString().replace("\n", "\n ");
- description += "Event Content:\n " + efiVarDescription.substring(0,
- efiVarDescription.length() - INDENT_3);
- break;
- case EvConstants.EV_EFI_VARIABLE_BOOT:
- description += "Event Content:\n" + new UefiVariable(eventContent).toString();
- break;
- case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
- EvEfiBootServicesApp bootServices = new EvEfiBootServicesApp(eventContent);
- description += "Event Content:\n" + bootServices.toString();
- break;
- case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER: // same as EV_EFI_BOOT_SERVICES_APP
- EvEfiBootServicesApp bootDriver = new EvEfiBootServicesApp(eventContent);
- description += "Event Content:\n" + bootDriver.toString();
- break;
- case EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER:
- break;
- case EvConstants.EV_EFI_GPT_EVENT:
- description += "Event Content:\n" + new EvEfiGptPartition(eventContent).toString();
- break;
- case EvConstants.EV_EFI_ACTION:
- description += new String(eventContent, StandardCharsets.UTF_8);
- break;
- case EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB:
- description += "Event Content:\n"
- + new UefiFirmware(eventContent).toString();
- break;
- case EvConstants.EV_EFI_HANDOFF_TABLES:
- EvEfiHandoffTable efiTable = new EvEfiHandoffTable(eventContent);
- description += "Event Content:\n" + efiTable.toString();
- break;
- case EvConstants.EV_EFI_HCRTM_EVENT:
- break;
- case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
- description += "Event Content:\n" + new UefiVariable(eventContent).toString();
- break;
- default:
- description += " Unknown Event found" + "\n";
- }
- return description;
- }
-
- /**
- * Converts the Event ID into a String As defined in the TCG PC Client FW Profile.
- * Event IDs have values larger than an integer,so a Long is used hold the value.
- *
- * @param event the event id.
- * @return TCG defined String that represents the event id
- */
- private static String eventString(final long event) {
-
- if (event == EvConstants.EV_PREBOOT_CERT) {
- return "EV_PREBOOT_CERT";
- } else if (event == EvConstants.EV_POST_CODE) {
- return "EV_POST_CODE";
- } else if (event == EvConstants.EV_UNUSED) {
- return "EV_Unused";
- } else if (event == EvConstants.EV_NO_ACTION) {
- return "EV_NO_ACTION";
- } else if (event == EvConstants.EV_SEPARATOR) {
- return "EV_SEPARATOR";
- } else if (event == EvConstants.EV_ACTION) {
- return "EV_ACTION";
- } else if (event == EvConstants.EV_EVENT_TAG) {
- return "EV_EVENT_TAG";
- } else if (event == EvConstants.EV_S_CRTM_CONTENTS) {
- return "EV_S_CRTM_CONTENTS";
- } else if (event == EvConstants.EV_S_CRTM_VERSION) {
- return "EV_S_CRTM_VERSION";
- } else if (event == EvConstants.EV_CPU_MICROCODE) {
- return "EV_CPU_MICROCODE";
- } else if (event == EvConstants.EV_PLATFORM_CONFIG_FLAGS) {
- return "EV_PLATFORM_CONFIG_FLAGS ";
- } else if (event == EvConstants.EV_TABLE_OF_DEVICES) {
- return "EV_TABLE_OF_DEVICES";
- } else if (event == EvConstants.EV_COMPACT_HASH) {
- return "EV_COMPACT_HASH";
- } else if (event == EvConstants.EV_IPL) {
- return "EV_IPL";
- } else if (event == EvConstants.EV_IPL_PARTITION_DATA) {
- return "EV_IPL_PARTITION_DATA";
- } else if (event == EvConstants.EV_NONHOST_CODE) {
- return "EV_NONHOST_CODE";
- } else if (event == EvConstants.EV_NONHOST_CONFIG) {
- return "EV_NONHOST_CONFIG";
- } else if (event == EvConstants.EV_NONHOST_INFO) {
- return "EV_NONHOST_INFO";
- } else if (event == EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS) {
- return "EV_EV_OMIT_BOOT_DEVICES_EVENTS";
- } else if (event == EvConstants.EV_EFI_EVENT_BASE) {
- return "EV_EFI_EVENT_BASE";
- } else if (event == EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG) {
- return "EV_EFI_VARIABLE_DRIVER_CONFIG";
- } else if (event == EvConstants.EV_EFI_VARIABLE_BOOT) {
- return "EV_EFI_VARIABLE_BOOT";
- } else if (event == EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION) {
- return "EV_EFI_BOOT_SERVICES_APPLICATION";
- } else if (event == EvConstants.EV_EFI_BOOT_SERVICES_DRIVER) {
- return "EV_EFI_BOOT_SERVICES_DRIVER";
- } else if (event == EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER) {
- return "EV_EFI_RUNTIME_SERVICES_DRIVER";
- } else if (event == EvConstants.EV_EFI_GPT_EVENT) {
- return "EV_EFI_GPT_EVENT";
- } else if (event == EvConstants.EV_EFI_ACTION) {
- return "EV_EFI_ACTION";
- } else if (event == EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB) {
- return "EV_EFI_PLATFORM_FIRMWARE_BLOB";
- } else if (event == EvConstants.EV_EFI_HANDOFF_TABLES) {
- return "EV_EFI_HANDOFF_TABLES";
- } else if (event == EvConstants.EV_EFI_HCRTM_EVENT) {
- return "EV_EFI_HCRTM_EVENT";
- } else if (event == EvConstants.EV_EFI_VARIABLE_AUTHORITY) {
- return "EV_EFI_VARIABLE_AUTHORITY";
- } else {
- return "Unknown Event ID " + event + " encountered";
- }
- }
-
- /**
- * Human readable output of a check of input against the current event hash.
- *
- * @return human readable string.
- */
- private String eventHashCheck() {
- String result = "";
- if (logFormat == 1) {
- if (Arrays.equals(this.digest, eventDataSha1hash)) {
- result
- += "Event digest matched hash of the event data " + "\n";
- } else {
- result += "Event digest DID NOT match the hash of the event data :"
- + Hex.encodeHexString(getEventDigest()) + "\n";
- }
- } else {
- if (Arrays.equals(this.digest, eventDataSha256hash)) {
- result += "Event digest matched hash of the event data " + "\n";
- } else {
- result += "Event digest DID NOT match the hash of the event data :"
- + Hex.encodeHexString(getEventDigest()) + "\n";
- }
- }
- return result;
- }
-
- /**
- * This method takes in an event and compares the hashes to verify that they match.
- * @param tpmPcrEvent an event to match.
- * @return true if the event # matches and the hash is correct.
- */
- public boolean eventCompare(final TpmPcrEvent tpmPcrEvent) {
- if (tpmPcrEvent.getPcrIndex() != this.getPcrIndex()) {
- return false;
- }
-
- return Arrays.equals(this.digest, tpmPcrEvent.getEventDigest());
- }
-
- /**
- * Checks a byte array for all zeros.
- *
- * @param array holds data to check.
- * @return true of all zeros are found.
- */
- public boolean isBlank(final byte[] array) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] != 0) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Human readable string representing the contents of the Event Log.
- *
- * @return Description of the log.
- */
- public String toString() {
- return description + "\n";
- }
-
- /**
- * Human readable string representing the contents of the Event Log.
- *
- * @param bEvent event Flag.
- * @param bContent content flag.
- * @param bHexEvent hex event flag.
- * @return Description of the log.
- */
- public String toString(final boolean bEvent, final boolean bContent, final boolean bHexEvent) {
- StringBuilder sb = new StringBuilder();
- if (bEvent) {
- sb.append(description);
- }
- if (bHexEvent) {
- if (bEvent || bContent) {
- sb.append("\n");
- }
- byte[] eventData = getEvent();
- sb.append("Event (Hex no Content) (" + eventData.length + " bytes): "
- + Hex.encodeHexString(eventData));
- }
- if (bContent) {
- byte[] evContent = getEventContent();
- if (bEvent) {
- sb.append("\n");
- }
- sb.append("Event content (Hex) (" + evContent.length + " bytes): "
- + Hex.encodeHexString(evContent));
- }
- return sb.toString() + "\n";
- }
-
- /**
- * Remove bad visual value text.
- * @param text content to operate over.
- * @return cleared string
- */
- public String cleanTextContent(final String text) {
- String result;
- // strips off all non-ASCII characters
- result = text.replaceAll("[^\\x00-\\x7F]", "");
-
- // erases all the ASCII control characters
- result = result.replaceAll("[\\p{Cntrl}&&[^\r\n\t]]", "");
-
- // removes non-printable characters from Unicode
- result = result.replaceAll("\\p{C}", "");
-
- return result.trim();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent1.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent1.java
deleted file mode 100644
index 8f9f026e..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent1.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog;
-
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.tpm.eventlog.events.EvConstants;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiConstants;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-
-/**
- * Class to process a TCG_PCR_EVENT.
- * TCG_PCR_EVENT is used when the Event log uses the SHA1 Format as described in the
- * TCG Platform Firmware Profile specification.
- * typedef struct {
- * UINT32 PCRIndex; //PCR Index value that either
- * //matches the PCRIndex of a
- * //previous extend operation or
- * //indicates that this Event Log
- * //entry is not associated with
- * //an extend operation
- * UINT32 EventType; //See Log event types
- * BYTE digest[20]; //The SHA1 hash of the event data
- * UINT32 EventSize; //Size of the event data
- * UINT8 Event[1]; //
- * } TCG_PCR_EVENT; //The event data structure to be added
- */
-public class TpmPcrEvent1 extends TpmPcrEvent {
-
- /**
- * Constructor.
- *
- * @param is ByteArrayInputStream holding the TCG Log event.
- * @param eventNumber event position within the event log.
- * @throws java.io.IOException if an error occurs in parsing the event.
- * @throws java.security.NoSuchAlgorithmException if an undefined algorithm is encountered.
- * @throws java.security.cert.CertificateException If a certificate within an event can't be processed.
- */
- public TpmPcrEvent1(final ByteArrayInputStream is, final int eventNumber)
- throws IOException, CertificateException, NoSuchAlgorithmException {
- super(is);
- setDigestLength(EvConstants.SHA1_LENGTH);
- setLogFormat(1);
- /** Event data. */
- byte[] event = null;
- byte[] rawIndex = new byte[UefiConstants.SIZE_4];
- byte[] rawType = new byte[UefiConstants.SIZE_4];
- byte[] rawEventSize = new byte[UefiConstants.SIZE_4];
- byte[] eventDigest = new byte[EvConstants.SHA1_LENGTH];
- byte[] eventContent = null;
- int digestSize = EvConstants.SHA1_LENGTH;
- int eventSize = 0;
- String hashName = "TPM_ALG_SHA1";
- if (is.available() > UefiConstants.SIZE_32) {
- is.read(rawIndex);
- setPcrIndex(rawIndex);
- is.read(rawType);
- setEventType(rawType);
- is.read(eventDigest);
- setEventDigest(eventDigest, digestSize);
- is.read(rawEventSize);
- eventSize = HexUtils.leReverseInt(rawEventSize);
- eventContent = new byte[eventSize];
- is.read(eventContent);
- setEventContent(eventContent);
- // copy entire event into a byte array for processing
- int eventLength = rawIndex.length + rawType.length + eventDigest.length
- + rawEventSize.length;
- int offset = 0;
- event = new byte[eventLength];
- System.arraycopy(rawIndex, 0, event, offset, rawIndex.length);
- offset += rawIndex.length;
- System.arraycopy(rawType, 0, event, offset, rawType.length);
- offset += rawType.length;
- System.arraycopy(eventDigest, 0, event, offset, eventDigest.length);
- offset += eventDigest.length;
- System.arraycopy(rawEventSize, 0, event, offset, rawEventSize.length);
- offset += rawEventSize.length;
- setEventData(event);
- //System.arraycopy(eventContent, 0, event, offset, eventContent.length);
- this.processEvent(event, eventContent, eventNumber, hashName);
- }
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent2.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent2.java
deleted file mode 100644
index 6ea1af58..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TpmPcrEvent2.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog;
-
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.tpm.eventlog.events.EvConstants;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiConstants;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-
-/**
- * Class to process a TCG_PCR_EVENT2 which is used
- * when the Event log uses the Crypto Agile (SHA256) format as described in the
- * TCG Platform Firmware Profile specification.
- * This class will only process SHA-256 digests.
- * typedef struct {
- * UINT32 PCRIndex; //PCR Index value that either
- * //matches the PCRIndex of a
- * //previous extend operation or
- * //indicates that this Event Log
- * //entry is not associated with
- * //an extend operation
- * UINT32 EventType; //See Log event types
- * TPML_DIGEST_VALUES digest; //The hash of the event data
- * UINT32 EventSize; //Size of the event data
- * BYTE Event[1]; //The event data
- * } TCG_PCR_EVENT2; //The event data structure to be added
- * typedef struct {
- * UINT32 count;
- * TPMT_HA digests[HASH_COUNT];
- * } TPML_DIGEST_VALUES;
- * typedef struct {
- * TPMI_ALG_HASH hashAlg;
- * TPMU_HA digest;
- * } TPMT_HA;
- * typedef union {
- * BYTE sha1[SHA1_DIGEST_SIZE];
- * BYTE sha256[SHA256_DIGEST_SIZE];
- * BYTE sha384[SHA384_DIGEST_SIZE];
- * BYTE sha512[SHA512_DIGEST_SIZE];
- * } TPMU_HA;
- * define SHA1_DIGEST_SIZE 20
- * define SHA256_DIGEST_SIZE 32
- * define SHA384_DIGEST_SIZE 48
- * define SHA512_DIGEST_SIZE 64
- * typedef TPM_ALG_ID TPMI_ALG_HASH;
- * typedef UINT16 TPM_ALG_ID;
- * define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004)
- * define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B)
- * define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C)
- * define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D)
- */
-public class TpmPcrEvent2 extends TpmPcrEvent {
- /**
- * algorithms found.
- */
- private int algCount = 0;
-
- /**
- * list of digests.
- */
- private ArrayList
- * DEVICE_PATH_PROTOCOL from the UEFI spec Section 10.1 page 284 of v2.8
- *
- * #define EFI_DEVICE_PATH_PROTOCOL_GUID \09576e91-6d3f-11d2-8e39-00a0c969723b
- * typedef struct _EFI_DEVICE_PATH_PROTOCOL {
- * UINT8 Type;
- * UINT8 SubType;
- * UINT8 Length[2];
- * } EFI_DEVICE_PATH_PROTOCOL; // ref page of the UEFI spec
- *
- * Where Type and Subtype are defined the UEFI spec section 10.3.1
- * Type 0x01 Hardware Device Path
- * Type 0x02 ACPI Device Path
- * Type 0x03 Messaging Device Path
- * Type 0x04 Media Device Path
- * Type 0x05 BIOS Boot Specification Device Path
- * Type 0x7F End of Hardware Device Path
- */
-public class EvEfiBootServicesApp {
- /**
- * UEFI Address.
- */
- private byte[] physicalAddress = null;
- /**
- * UEFI Image Length.
- */
- @Getter
- private int imageLength = 0;
- /**
- * UEFI Link Time image address.
- */
- private byte[] linkTimeAddress = null;
- /**
- * UEFI Device Path Length.
- */
- @Getter
- private int devicePathLength = 0;
- /**
- * UEFI Device path.
- */
- @Getter
- private UefiDevicePath devicePath = null;
- /**
- * Is the Device Path Valid.
- */
- private boolean devicePathValid = false;
-
- /**
- * EvEFIBootServicesApp constructor.
- *
- * @param bootServices byte array holding the event data.
- * @throws java.io.UnsupportedEncodingException if parsing issues exists.
- */
- public EvEfiBootServicesApp(final byte[] bootServices) throws UnsupportedEncodingException {
- physicalAddress = new byte[UefiConstants.SIZE_8];
- System.arraycopy(bootServices, 0, physicalAddress, 0, UefiConstants.SIZE_8);
- byte[] lengthBytes = new byte[UefiConstants.SIZE_8];
- System.arraycopy(bootServices, UefiConstants.OFFSET_8, lengthBytes, 0, UefiConstants.SIZE_8);
- imageLength = HexUtils.leReverseInt(lengthBytes);
- linkTimeAddress = new byte[UefiConstants.SIZE_8];
- System.arraycopy(bootServices, UefiConstants.OFFSET_16, linkTimeAddress, 0,
- UefiConstants.SIZE_8);
- System.arraycopy(bootServices, UefiConstants.SIZE_24, lengthBytes, 0, UefiConstants.SIZE_8);
- // if (imageLength != 0) {
- devicePathLength = HexUtils.leReverseInt(lengthBytes);
- if (devicePathLength != 0) {
- byte[] devPathBytes = new byte[devicePathLength];
- System.arraycopy(bootServices, UefiConstants.SIZE_32, devPathBytes,
- 0, devicePathLength);
- devicePath = new UefiDevicePath(devPathBytes);
- devicePathValid = true;
- }
- }
-
- /**
- * Returns the address of the physical image of the boot services application.
- *
- * @return address of the physical image.
- */
- public byte[] getImagePhysicalAddress() {
- return Arrays.copyOf(physicalAddress, physicalAddress.length);
- }
-
- /**
- * Returns the length of a link time image referenced by this event.
- *
- * @return length of the link time image.
- */
- public byte[] getImageLinkTimeAddress() {
- return Arrays.copyOf(linkTimeAddress, linkTimeAddress.length);
- }
-
-
- /**
- * Returns a human readable string of the Boot Service info.
- *
- * @return a human readable string.
- */
- public String toString() {
- String info = "Image info: ";
- info += " Image physical address: " + HexUtils.byteArrayToHexString(physicalAddress);
- info += " Image length = " + imageLength;
- info += " Image link time address: " + HexUtils.byteArrayToHexString(physicalAddress);
- info += " Device path length = " + devicePathLength;
- if (devicePathValid) {
- info += "\n" + devicePath.toString();
- } else {
- info += "\n No uefi device paths were specified";
- }
- return info;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiGptPartition.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiGptPartition.java
deleted file mode 100644
index 7d30c875..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvEfiGptPartition.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.events;
-
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiConstants;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiPartition;
-import lombok.Getter;
-
-import java.io.UnsupportedEncodingException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-
-/**
- * Class to process the PC Client Firmware profile defined EV_EFI_GPT_EVENT event.
- * The EV_EFI_GPT_EVENT event data contains the UEFI_GPT_DATA structure as defined in the PFP
- * line 2860:
- *
- * typedef struct {
- * UEFI_PARTITION_TABLE_HEADER UEFIPartitionHeader; // same as UINT64 for current x86 devices
- * UINT64 NumberOfPartitions;
- * UEFI_PARTITION_ENTRY Partitions [NumberOfPartitions];
- * }UEFI_GPT_DATA;
- *
- * The UEFI spec defines the EFI_TABLE_HEADER and EFI_PARTITION_ENTRY
- *
- * * typedef struct {
- * UINT64 Signature; // A 64-bit signature that identifies the type of table that follows.
- * UINT32 Revision;
- * UINT32 HeaderSize;
- * UINT32 CRC32;
- * UINT32 Reserved;
- * } EFI_TABLE_HEADER;
- *
- * typedef struct {
- * EFI_GUID PartitionTypeGUID;
- * EFI_GUID UniquePartitionGUID;
- * EFI_LBA StartingLBA; // Same as UINT64.
- * EFI_LBA EndingLBA;
- * UINT64 Attributes;
- * CHAR16 PartitionName[36]; // 36 CHAR16 = 72 Bytes
- * } EFI_PARTITION_ENTRY;
- *
- * EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
- * EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42
- * EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
- *
- * UEFI Table 23. Defined GPT Partition Entry - Partition Type GUIDs
- * Unused Entry 00000000-0000-0000-0000-000000000000
- * EFI System Partition C12A7328-F81F-11D2-BA4B-00A0C93EC93B
- * Partition containing a legacy MBR 024DEE41-33E7-11D3-9D69-0008C781F39F
- */
-public class EvEfiGptPartition {
- /**
- * Header Size.
- */
- private int headerSize = 0;
- /**
- * Header bytes.
- */
- private byte[] header = new byte[UefiConstants.SIZE_8];
- /**
- * Number of partitions in this event.
- */
- private int numberOfPartitions;
- /**
- * Partition Length.
- */
- private int partitonEntryLength = UefiConstants.SIZE_128;
- /**
- * List of Partitions.
- */
- @Getter
- private ArrayList
- * tdUEFI_HANDOFF_TABLE_POINTERS {
- * UINT64 NumberOfTables;
- * UEFI_CONFIGURATION_TABLE TableEntry[NumberOfTables];
- * }UEFI_HANDOFF_TABLE_POINTERS;
- *
- * The UEFI_CONFIGURATION_TABLE id defined in the UEFI spec as:
- *
- * typedef struct{
- * EFI_GUID VendorGuid;
- * VOID *VendorTable;
- * } EFI_CONFIGURATION_TABLE;
- * Where the defines
- * VendorGuid: The 128-bit GUID value that uniquely identifies the system configuration table.
- * VendorTable: A pointer to the table associated with VendorGuid.
- * Section 4.6 of the UEFI spec has a listing of some of the industry defined
- * standard that define the particular table.
- */
-public class EvEfiHandoffTable {
- /**
- * Number of Tables.
- */
- @Getter
- private int numberOfTables = 0;
- /**
- * List of Vendor GUIDs.
- */
- private ArrayList
- * typedef struct tdTCG_EfiSpecIdEvent {
- * BYTE Signature[16];
- * UINT32 platformClass;
- * UINT8 specVersionMinor;
- * UINT8 specVersionMajor;
- * UINT8 specErrata;
- * UINT8 uintnSize;
- * UINT32 numberOfAlgorithms;
- * TCG_EfiSpecIdEventAlgorithmSize digestSizes[numberOfAlgorithms];
- * UINT8 vendorInfoSize;
- * BYTE vendorInfo[VendorInfoSize];
- * } TCG_EfiSpecIDEvent;
- *
- * typedef struct tdTCG_EfiSpecIdEventAlgorithmSize {
- * UINT16 algorithmId;
- * UINT16 digestSize;
- * } TCG_EfiSpecIdEventAlgorithmSize;
- *
- * define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004)
- * define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B)
- * define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C)
- * define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D)
- *
- * Notes: Parses event data for an EfiSpecID per Table 5 TCG_EfiSpecIdEvent Example.
- * 1. Should be the first Structure in the log
- * 2. Has an EventType of EV_NO_ACTION (0x00000003)
- * 3. Digest of 20 bytes of all 0's
- * 4. Event content defined as TCG_EfiSpecIDEvent Struct.
- * 5. First 16 bytes of the structure is an ASCII "Spec ID Event03"
- * 6. The version of the log is used to determine which format the Log
- * is to use (sha1 or Crypto Agile)
- */
-@Getter
-public class EvEfiSpecIdEvent {
- /**
- * Minor Version.
- */
- private String versionMinor = "";
- /**
- * Major Version.
- */
- private String versionMajor = "";
- /**
- * Specification errata version.
- */
- private String errata = "";
- /**
- * Signature (text) data.
- */
- private String signature = "";
- /**
- * Platform class.
- */
- private String platformClass = "";
- /**
- * Algorithm count.
- */
- private int numberOfAlg = 0;
- /**
- * True if event log uses Crypto Agile format.
- */
- private boolean cryptoAgile = false;
- /**
- * Algorithm list.
- */
- private ArrayList
- * Notes:
- * 1. First 16 bytes of the structure is an ASCII with a fixed Length of 16
- * 2. Add processing of other NoEvent types when new ones get defined
- */
-public class EvNoAction {
-
- /**
- * Signature (text) data.
- */
- private String signature = "";
- /**
- * True of the event is a SpecIDEvent.
- */
- private boolean bSpecIDEvent = false;
- /**
- * EvEfiSpecIdEvent Object.
- */
- @Getter
- private EvEfiSpecIdEvent specIDEvent = null;
-
- /**
- * EvNoAction constructor.
- *
- * @param eventData byte array holding the event to process.
- * @throws java.io.UnsupportedEncodingException if input fails to parse.
- */
- public EvNoAction(final byte[] eventData) throws UnsupportedEncodingException {
- byte[] signatureBytes = new byte[UefiConstants.SIZE_15];
- System.arraycopy(eventData, 0, signatureBytes, 0, UefiConstants.SIZE_15);
- signature = new String(signatureBytes, StandardCharsets.UTF_8);
- signature = signature.replaceAll("[^\\P{C}\t\r\n]", ""); // remove null characters
- if (signature.contains("Spec ID Event03")) { // implies CryptAgileFormat
- specIDEvent = new EvEfiSpecIdEvent(eventData);
- bSpecIDEvent = true;
- }
- }
-
- /**
- * Determines if this event is a SpecIDEvent.
- *
- * @return true of the event is a SpecIDEvent.
- */
- public boolean isSpecIDEvent() {
- return bSpecIDEvent;
- }
-
- /**
- * Returns a description of this event.
- *
- * @return Human readable description of this event.
- */
- public String toString() {
- String specInfo = "";
- if (bSpecIDEvent) {
- specInfo += " Signature = Spec ID Event03 : ";
- if (specIDEvent.isCryptoAgile()) {
- specInfo += "Log format is Crypto Agile\n";
- } else {
- specInfo += "Log format is SHA 1 (NOT Crypto Agile)\n";
- }
- specInfo += " Platform Profile Specification version = "
- + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor()
- + " using errata version " + specIDEvent.getErrata();
- } else {
- specInfo = "EV_NO_ACTION event named " + signature
- + " encountered but support for processing it has not been added to this application.\n";
- }
- return specInfo;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvPostCode.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvPostCode.java
deleted file mode 100644
index a56b3064..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvPostCode.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.events;
-
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiFirmware;
-import lombok.Getter;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * Class for processing EV_POST_CODE event types
- *
- * typedef struct tdUEFI_PLATFORM_FIRMWARE_BLOB {
- * UEFI_PHYSICAL_ADDRESS BlobBase; // Same as UINT64 for most systems
- * UINT64 BlobLength;
- * } UEFI_PLATFORM_FIRMWARE_BLOB;
- *
- * However Table 9 of the PC Client Platform firmware profile states that even content is a string
- * For POST code, the event data SHOULD be POST CODE.
- * For embedded SMM code, the event data SHOULD be SMM CODE.
- * For ACPI flash data, the event data SHOULD be ACPI DATA.
- * For BIS code, the event data SHOULD be BIS CODE.
- * For embedded option ROMs, the event data SHOULD be Embedded UEFI Driver.
- */
-public class EvPostCode {
- /** Event Description. */
- private String codeInfo = "";
- /** String type flag. */
- private boolean bisString = false;
- /** Firmware object. */
- @Getter
- private UefiFirmware firmwareBlob = null;
-
- /**
- * EcPostCode constructor.
- * @param postCode byte array holding the post code content.
- */
- public EvPostCode(final byte[] postCode) {
- // 2 ways post code has been implemented, check for the ascii string first
- if (isAscii(postCode)) {
- codeInfo = new String(postCode, StandardCharsets.UTF_8);
- bisString = true;
- } else {
- firmwareBlob = new UefiFirmware(postCode);
- }
- }
-
- /**
- * Flag set to true if Post Code is a string.
- * @return true if Post Code is a string.
- */
- public boolean isString() {
- return bisString;
- }
-
- /**
- * Returns a human readable string of the Post Code information.
- * @return human readable string.
- */
- public String toString() {
- if (bisString) {
- return codeInfo;
- }
- return firmwareBlob.toString();
- }
-
- /**
- * Determines if the byte array is a string.
- * @param postCode byte array input.
- * @return true if byte array is a string.
- */
- public static boolean isAscii(final byte[] postCode) {
- for (byte b : postCode) {
- if (!Character.isDefined(b)) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmContents.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmContents.java
deleted file mode 100644
index 0f33be7e..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmContents.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.events;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * Class to process the PC Client Firmware profile defined EV_S_CRTM_CONTENTS event.
- */
-public class EvSCrtmContents {
-
- private String description = "";
-
- /**
- * Constructor that takes in the event data and waits to be called.
- * @param event byte array holding the event content data.
- */
- public EvSCrtmContents(final byte[] event) {
- scrtmContents(event);
- }
-
- /**
- * Checks if event data is null and if not it converts to a String.
- * @param event byte array holding the event data.
- * @return String contents contained within the event.
- */
- public String scrtmContents(final byte[] event) {
- if (event == null) {
- description = "invalid content event data";
- } else {
- description = new String(event, StandardCharsets.UTF_8);
- }
- return description;
- }
-
- /**
- * Human readable string contained within the CRTM Contents event.
- * @return Human readable string.
- */
- public String toString() {
- return description;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmVersion.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmVersion.java
deleted file mode 100644
index bafd7689..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/EvSCrtmVersion.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.events;
-
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiConstants;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiGuid;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
-
-/**
- * Class to process the PC Client Firmware profile defined EV_S_CRTM_VERSION event.
- */
-public class EvSCrtmVersion {
-
- private String description = "";
-
- /**
- * Constructor that takes in the event data and waits to be called.
- *
- * @param event byte array holding the event content data.
- * @throws java.io.UnsupportedEncodingException if parsing issues exist.
- */
- public EvSCrtmVersion(final byte[] event) throws UnsupportedEncodingException {
- sCrtmVersion(event);
- }
-
- /**
- * Checks if event data is null and if not it converts to a String.
- *
- * @param data byte array holding the vent content.
- * @return String representation of the version.
- */
- public String sCrtmVersion(final byte[] data) {
- UefiGuid guid = null;
- if (data == null) {
- description = "invalid content event data";
- } else {
- if (data.length == UefiConstants.SIZE_16) {
- if (UefiGuid.isValidUUID(data)) {
- guid = new UefiGuid(data);
- String guidInfo = guid.toStringNoLookup();
- description = " SCRM Version = " + guidInfo;
- }
- } else if (data.length < UefiConstants.SIZE_4) {
- description = HexUtils.byteArrayToHexString(data);
- } else if (EvPostCode.isAscii(data)) {
- description = new String(data, StandardCharsets.UTF_8);
- } else {
- description = "Unknown Version format";
- }
- }
- return (description);
- }
-
- /**
- * Return function to send data to the toString.
- *
- * @return String representation of the version.
- */
- public String toString() {
- return description;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/package-info.java
deleted file mode 100644
index 7a472b06..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/events/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Non-persistant classes related to TGC Event Logs.
- */
-
-package hirs.attestationca.portal.utils.tpm.eventlog.events;
-
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/package-info.java
deleted file mode 100644
index 26cb77db..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Non-persistant classes related to TGC Event Logs.
- */
-
-package hirs.attestationca.portal.utils.tpm.eventlog;
-
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootOrder.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootOrder.java
deleted file mode 100644
index d28e9bc1..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootOrder.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-/**
- * Class to process a UEFI BootOrder variable.
- * UEFI spec version 2.8 section 3.3 on page 83 defines the Boot Order as:
- * an array of UINT16s that make up an ordered list of the Boot#### options.
- */
-public class UefiBootOrder {
- /**
- * list of UINT16 Boot#### numbers.
- */
- private char[] bootOrder = null;
-
- /**
- * Process the BootOrder UEFI variable.
- *
- * @param order byte array holding the UEFI boot order variable.
- */
- UefiBootOrder(final byte[] order) {
- bootOrder = new char[order.length / UefiConstants.SIZE_2];
- for (int i = 0; i < order.length; i += UefiConstants.SIZE_2) {
- bootOrder[i / UefiConstants.SIZE_2] =
- (char) (order[i + 1] * UefiConstants.SIZE_256 + order[i]);
- }
- }
-
- /**
- * Provides a human readable Boot Order list on single line.
- *
- * @return A human readable Boot Order
- */
- public String toString() {
- StringBuilder orderList = new StringBuilder();
- orderList.append("BootOrder = ");
- for (int i = 0; i < bootOrder.length; i++) {
- orderList.append(String.format("Boot %04d", (int) bootOrder[i]));
- }
- //orderList.append("\n");
- return orderList.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootVariable.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootVariable.java
deleted file mode 100644
index 7f48463b..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiBootVariable.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import hirs.attestationca.utils.HexUtils;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-
-/**
- * Class to process a UEFI Boot#### variable.
- * Data is defined using the EFI_LOAD_OptionStructure:
- * typedef struct _EFI_LOAD_OPTION {
- * UINT32 Attributes;
- * UINT16 FilePathListLength;
- * // CHAR16 Description[];
- * // EFI_DEVICE_PATH_PROTOCOL FilePathList[];
- * // UINT8 OptionalData[];
- * } EFI_LOAD_OPTION;
- *
- * No length field for the Description is given
- * so we need to calculate it by search for a null termination on the Description field
- * Data following the Description should be an EFI Device Path
- */
-public class UefiBootVariable {
- /**
- * Human readable description of the variable.
- */
- private String description = "";
- /**
- * Variable attributes.
- */
- private byte[] attributes = null;
- /**
- * Firmware memory blob.
- */
- private byte[] blob = null;
- /**
- * UEFI Device Path.
- */
- private UefiDevicePath efiDevPath = null;
-
- /**
- * UefiBootVariable Constructor.
- *
- * @param bootVar byte array holding the boot variable.
- * @throws java.io.UnsupportedEncodingException if the data fails to parse.
- */
- public UefiBootVariable(final byte[] bootVar) throws UnsupportedEncodingException {
- attributes = new byte[UefiConstants.SIZE_4];
- System.arraycopy(bootVar, 0, attributes, 0, UefiConstants.SIZE_4);
- byte[] blobLen = new byte[UefiConstants.SIZE_2];
- System.arraycopy(bootVar, UefiConstants.OFFSET_4, blobLen, 0, UefiConstants.SIZE_2);
- int blobLength = HexUtils.leReverseInt(blobLen);
- if (blobLength % UefiConstants.SIZE_2 == 0) {
- blob = new byte[blobLength];
- } else {
- blob = new byte[blobLength + 1];
- }
- System.arraycopy(bootVar, UefiConstants.OFFSET_6, blob, 0, blobLength);
- int descLength = getChar16ArrayLength(blob);
- byte[] desc = new byte[descLength * UefiConstants.SIZE_2];
- System.arraycopy(bootVar, UefiConstants.OFFSET_6, desc, 0, descLength * UefiConstants.SIZE_2);
- description = new String(UefiDevicePath.convertChar16tobyteArray(desc), StandardCharsets.UTF_8);
- // Data following the Description should be EFI Partition Data (EFI_DEVICE_PATH_PROTOCOL)
- int devPathLength = blobLength;
- int devPathOffset = UefiConstants.OFFSET_6 + descLength; //attributes+bloblength+desc+length+2
- byte[] devPath = new byte[devPathLength];
- System.arraycopy(bootVar, devPathOffset, devPath, 0, devPathLength);
- efiDevPath = new UefiDevicePath(devPath);
- }
-
- /**
- * Returns a string that represents a UEFI boot variable.
- * Some devices have not properly terminated the Description filed with null characters
- * so garbage bytes are appended to the string that we must strip off.
- * All non-alpha numeric is stripped from the string.
- *
- * @return string that represents a UEFI boot variable.
- */
- public String toString() {
- StringBuilder bootInfo = new StringBuilder("Description = ");
- String bootVar = description.replaceAll("[^a-zA-Z_0-0\\s]", ""); // remove all non ascii chars
- bootInfo.append(bootVar + "\n" + efiDevPath.toString());
- return bootInfo.toString();
- }
-
- /**
- * Searches for the first char16 based null character (2 bytes of zeros).
- * Searches in a given byte array and returns the length of data up to that point in bytes.
- *
- * @param data a byte array to search for the data.
- * @return the length of the data in bytes at the beginning of the byte array.
- * which was terminated by a null character.
- */
- public int getChar16ArrayLength(final byte[] data) {
- int count = 0;
- byte[] nullTerminator = new byte[UefiConstants.SIZE_2];
- byte[] char16 = new byte[UefiConstants.SIZE_2];
- nullTerminator[0] = 0;
- nullTerminator[1] = 0;
- for (int i = 0; i < data.length; i += UefiConstants.SIZE_2) {
- char16[0] = data[i];
- char16[1] = data[i + 1];
- count++;
- if (Arrays.equals(nullTerminator, char16)) {
- return count * UefiConstants.SIZE_2;
- }
- }
- return count * UefiConstants.SIZE_2 + 1;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiConstants.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiConstants.java
deleted file mode 100644
index 2578ee62..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiConstants.java
+++ /dev/null
@@ -1,274 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-/**
- * This class contains the String constants that are referenced by UEFI.
- * It is expected that member properties of this class will expand as
- * more functionality is added.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class UefiConstants {
-
- /**
- * 2 byte size.
- */
- public static final int SIZE_2 = 2;
- /**
- * 4 byte size.
- */
- public static final int SIZE_4 = 4;
- /**
- * 5 byte size.
- */
- public static final int SIZE_5 = 5;
- /**
- * 8 byte size.
- */
- public static final int SIZE_8 = 8;
- /**
- * 12 byte size.
- */
- public static final int SIZE_12 = 12;
- /**
- * 15 byte size.
- */
- public static final int SIZE_15 = 15;
- /**
- * 16 byte size.
- */
- public static final int SIZE_16 = 16;
- /**
- * 20 byte size.
- */
- public static final int SIZE_20 = 20;
- /**
- * 21 byte size.
- */
- public static final int SIZE_21 = 21;
- /**
- * 22 byte size.
- */
- public static final int SIZE_22 = 22;
- /**
- * 23 byte size.
- */
- public static final int SIZE_23 = 23;
- /**
- * 24 byte size.
- */
- public static final int SIZE_24 = 24;
- /**
- * 28 byte size.
- */
- public static final int SIZE_28 = 28;
- /**
- * 32 byte size.
- */
- public static final int SIZE_32 = 32;
- /**
- * 40 byte size.
- */
- public static final int SIZE_40 = 40;
- /**
- * 128 byte size.
- */
- public static final int SIZE_128 = 128;
- /**
- * 256 byte size.
- */
- public static final int SIZE_256 = 256;
- /**
- * 1 byte offset.
- */
- public static final int OFFSET_1 = 1;
- /**
- * 2 byte offset.
- */
- public static final int OFFSET_2 = 2;
- /**
- * 3 byte offset.
- */
- public static final int OFFSET_3 = 3;
- /**
- * 4 byte offset.
- */
- public static final int OFFSET_4 = 4;
- /**
- * 5 byte offset.
- */
- public static final int OFFSET_5 = 5;
- /**
- * 6 byte offset.
- */
- public static final int OFFSET_6 = 4;
- /**
- * 8 byte offset.
- */
- public static final int OFFSET_8 = 8;
- /**
- * 16 byte offset.
- */
- public static final int OFFSET_16 = 16;
- /**
- * 20 byte offset.
- */
- public static final int OFFSET_20 = 20;
- /**
- * 21 byte offset.
- */
- public static final int OFFSET_21 = 21;
- /**
- * 22 byte offset.
- */
- public static final int OFFSET_22 = 22;
- /**
- * 24 byte offset.
- */
- public static final int OFFSET_24 = 24;
- /**
- * 28 byte offset.
- */
- public static final int OFFSET_28 = 28;
- /**
- * 28 byte offset.
- */
- public static final int OFFSET_32 = 32;
- /**
- * 40 byte offset.
- */
- public static final int OFFSET_40 = 40;
- /**
- * 41 byte offset.
- */
- public static final int OFFSET_41 = 41;
- /**
- * Device path terminator.
- */
- public static final int TERMINATOR = 0x7f;
- /**
- * Device path end flag.
- */
- public static final int END_FLAG = 0xff;
- /**
- * Device Type Hardware.
- */
- public static final int DEV_HW = 0x01;
- /**
- * Device Type ACPI.
- */
- public static final int DEV_ACPI = 0x02;
- /**
- * Device Type Messaging.
- */
- public static final int DEV_MSG = 0x03;
- /**
- * Device Type Media.
- */
- public static final int DEV_MEDIA = 0x04;
- /**
- * Device Type Hardware.
- */
- public static final int DEV_BIOS = 0x05;
- /**
- * Device Sub-Type USV.
- */
- public static final int DEV_SUB_USB = 0x05;
- /**
- * Device Sub-Type Sata.
- */
- public static final int DEV_SUB_SATA = 0x12;
- /**
- * Device Sub-Type nvm.
- */
- public static final int DEV_SUB_NVM = 0x17;
- /**
- * BIOS Device Path reserved.
- */
- public static final int DEVPATH_BIOS_RESERVED = 0x0;
- /**
- * BIOS Device Path for Floppy disks.
- */
- public static final int DEVPATH_BIOS_FLOPPY = 0x01;
- /**
- * BIOS Device Path Hard drives.
- */
- public static final int DEVPATH_BIOS_HD = 0x02;
- /**
- * BIOS Device Path for CD Drives.
- */
- public static final int DEVPATH_BIOS_CD = 0x03;
- /**
- * BIOS Device Path for PCM CIA drives.
- */
- public static final int DEVPATH_BIOS_PCM = 0x04;
- /**
- * BIOS Device Path for USB Drives.
- */
- public static final int DEVPATH_BIOS_USB = 0x05;
- /**
- * BIOS Device Path for embedded network.
- */
- public static final int DEVPATH_BIOS_EN = 0x06;
- /**
- * BIOS Device Path for a Bootstrap Entry Vector (BEV) from an option ROM.
- */
- public static final int DEVPATH_BIOS_BEV = 0x80;
- /**
- * Hardware Device Path.
- */
- public static final int DEVPATH_HARWARE = 0x1;
- /**
- * 2 byte size.
- */
- public static final int DEVPATH_VENDOR = 0x03;
- /**
- * 2 byte size.
- */
- public static final int DEVPATH_FILE = 0x04;
- /**
- * PIWG File device path type.
- */
- public static final int DEVPATH_PWIG_FILE = 0x06;
- /**
- * PIWG Volume device path type.
- */
- public static final int DEVPATH_PWIG_VOL = 0x07;
- /**
- * PC-AT compatible legacy MBR.
- */
- public static final int DRIVE_TYPE_PC_AT = 0x01;
- /**
- * GUID Partition Table type.
- */
- public static final int DRIVE_TYPE_GPT = 0x02;
- /**
- * Drive Signature type.
- */
- public static final int DRIVE_SIG_NONE = 0x00;
- /**
- * Drive Signature type.
- */
- public static final int DRIVE_SIG_32BIT = 0x01;
- /**
- * Drive Signature type.
- */
- public static final int DRIVE_SIG_GUID = 0x02;
- /**
- * standard byte length.
- */
- public static final int BYTE_LENGTH = 8;
- /**
- * standard byte length.
- */
- public static final int ATTRIBUTE_LENGTH = 48;
- /**
- * standard byte length.
- */
- public static final int PART_NAME_LENGTH = 56;
- /**
- * standard UEFI partition table lengh.
- */
- public static final int UEFI_PT_LENGTH = 72;
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiDevicePath.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiDevicePath.java
deleted file mode 100644
index dea0d48e..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiDevicePath.java
+++ /dev/null
@@ -1,488 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import hirs.attestationca.utils.HexUtils;
-import lombok.Getter;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
-
-/**
- * Class to process EFI_DEVICE_PATH_PROTOCOL which is referred to as the UEFI_DEVICE_PATH
- *
- * #define EFI_DEVICE_PATH_PROTOCOL_GUID \09576e91-6d3f-11d2-8e39-00a0c969723b
- * typedef struct _EFI_DEVICE_PATH_PROTOCOL {
- * UINT8 Type;
- * UINT8 SubType;
- * UINT8 Length[2];
- * } EFI_DEVICE_PATH_PROTOCOL;
- *
- * Where Type is defined in the UEFI spec section 10:
- * Type 0x01 Hardware Device Path
- * Type 0x02 ACPI Device Path
- * Type 0x03 Messaging Device Path
- * Type 0x04 Media Device Path
- * Type 0x05 BIOS Boot Specification Device Path
- * Type 0x7F End of Hardware Device Path
- * Each Type has a sub-type that may or may no be defined in the section
- *
- * Only a few of the SubTypes have been implemented as there are many,
- * but only those that were reported using the test devices at hand.
- * Without test patterns, the processing may lead to an un-handled exception
- */
-public class UefiDevicePath {
- /**
- * UEFI Device path type.
- */
- @Getter
- private String type = "";
- /**
- * UEFI Device path sub-type.
- */
- private String subType = "";
- /**
- * UEFI Device path human readable description.
- */
- private String devPathInfo = "";
- /**
- * UEFI Device path length.
- */
- @Getter
- private int length = 0;
-
- /**
- * UEFI Device path constructor.
- *
- * @param path byte array holding device path data
- * @throws java.io.UnsupportedEncodingException if path byte array contains unexpected values
- */
- public UefiDevicePath(final byte[] path) throws UnsupportedEncodingException {
- devPathInfo = processDevPath(path);
- byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
- System.arraycopy(path, UefiConstants.OFFSET_2, lengthBytes, 0, UefiConstants.OFFSET_2);
- length = HexUtils.leReverseInt(lengthBytes);
- }
-
- /**
- * Returns the UEFI device sub-type.
- *
- * @return uefi sub-type
- */
- public String getSubType() {
- return subType.trim();
- }
-
- /**
- * Processes the UEFI device path.
- * UEFI device path is a collection of EFI_DEVICE_PATH_PROTOCOL structures of variable length.
- * length must be calculated for each device path and used as an offset.
- * devPath is terminated by 07f and 0xff per the UEFi spec.
- *
- * @param path byte array holding the Device path
- * @return Human readable string containing the device path description.
- * @throws java.io.UnsupportedEncodingException
- */
- private String processDevPath(final byte[] path) throws UnsupportedEncodingException {
- StringBuilder pInfo = new StringBuilder();
- int devLength = 0, pathOffset = 0, devCount = 0;
- while (true) {
- Byte devPath = Byte.valueOf(path[pathOffset]);
- if ((devPath.intValue() == UefiConstants.TERMINATOR)
- || (devPath.intValue() == UefiConstants.END_FLAG)) {
- break;
- }
- if (devCount++ > 0) {
- pInfo.append("\n");
- }
- pInfo.append(processDev(path, pathOffset));
- devLength = path[pathOffset + UefiConstants.OFFSET_3] * UefiConstants.SIZE_256
- + path[pathOffset + UefiConstants.OFFSET_2];
- pathOffset = pathOffset + devLength;
- if (pathOffset >= path.length) {
- break;
- }
- }
- return pInfo.toString();
- }
-
- /**
- * Processes a specific UEFI device path, only limited set of types and subtypes are supported.
- * Current types processed include Hardware Device Path, ACPI Device Path,
- * Messaging Device Path, and Media Device Path.
- *
- * @param path
- * @param offset
- * @return human readable string representing the UEFI device path
- * @throws java.io.UnsupportedEncodingException
- */
- private String processDev(final byte[] path, final int offset)
- throws UnsupportedEncodingException {
- String devInfo = " ";
- int devPath = path[offset];
- byte unknownSubType = path[offset + UefiConstants.OFFSET_1];
- switch (path[0 + offset]) {
- case UefiConstants.DEV_HW:
- type = "Hardware Device Path";
- if (devPath == UefiConstants.DEVPATH_HARWARE) {
- devInfo += type + ": " + pciSubType(path, offset);
- }
- break;
- case UefiConstants.DEV_ACPI:
- type = "ACPI Device Path";
- devInfo += type + ": " + acpiSubType(path, offset);
- break;
- case UefiConstants.DEV_MSG:
- type = "Messaging Device Path";
- if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEV_SUB_SATA) {
- devInfo += type + ": " + sataSubType(path, offset);
- } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEV_SUB_NVM) {
- devInfo += type + ": " + nvmSubType(path, offset);
- } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEV_SUB_USB) {
- devInfo += type + ": " + usbSubType(path, offset);
- } else {
- devInfo += "UEFI Messaging Device Path Type " + Integer.valueOf(unknownSubType);
- }
- break;
- case UefiConstants.DEV_MEDIA:
- type = "Media Device Path";
- if (path[offset + UefiConstants.OFFSET_1] == 0x01) {
- devInfo += type + ": " + hardDriveSubType(path, offset);
- } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_VENDOR) {
- devInfo += type + ": " + vendorSubType(path, offset);
- } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_FILE) {
- devInfo += type + ": " + filePathSubType(path, offset);
- } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_PWIG_FILE) {
- devInfo += type + ": " + piwgFirmVolFile(path, offset);
- } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_PWIG_VOL) {
- devInfo += type + ": " + piwgFirmVolPath(path, offset);
- } else {
- devInfo += "UEFI Media Device Path Type " + Integer.valueOf(unknownSubType);
- }
- break;
- case UefiConstants.DEV_BIOS:
- type = "BIOS Device Path";
- devInfo += type + ": " + biosDevicePath(path, offset);
- break;
- case UefiConstants.TERMINATOR:
- devInfo += "End of Hardware Device Path";
- break;
- default:
- devInfo += "UEFI Device Path Type " + Integer.valueOf(unknownSubType);
- }
- return devInfo;
- }
-
- /**
- * processes the ACPI UEFI device subtype.
- *
- * @param path
- * @param offset
- * @return acpi device info
- */
- private String acpiSubType(final byte[] path, final int offset) {
- subType = "";
- switch (path[offset + UefiConstants.OFFSET_1]) {
- case 0x01:
- subType = "(Short): ";
- subType += acpiShortSubType(path, offset);
- break;
- case 0x02:
- subType = "Expanded ACPI Device Path";
- break;
- default:
- subType = "Invalid ACPI Device Path sub type";
- }
- return subType;
- }
-
- /**
- * Processes the ACPI short subtype.
- *
- * @param path
- * @param offset
- * @return short acpi info.
- */
- private String acpiShortSubType(final byte[] path, final int offset) {
- subType = "";
- byte[] hid = new byte[UefiConstants.SIZE_4];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, hid, 0, UefiConstants.SIZE_4);
- subType += "_HID = " + HexUtils.byteArrayToHexString(hid);
- System.arraycopy(path, 2 * UefiConstants.SIZE_4 + offset, hid, 0, UefiConstants.SIZE_4);
- subType += "_UID = " + HexUtils.byteArrayToHexString(hid);
- return subType;
- }
-
- /**
- * Processes the PCI subType.
- *
- * @param path
- * @param offset
- * @return pci device info.
- */
- private String pciSubType(final byte[] path, final int offset) {
- subType = "PCI: PCI Function Number = ";
- subType += String.format("0x%x", path[offset + UefiConstants.SIZE_4]);
- subType += " PCI Device Number = ";
- subType += String.format("0x%x", path[offset + UefiConstants.SIZE_5]);
- return subType;
- }
-
- /**
- * processes the SATA sub type.
- *
- * @param path
- * @param offset
- * @return SATA drive info.
- */
- private String sataSubType(final byte[] path, final int offset) {
- subType = "SATA: HBA Port Number = ";
- byte[] data = new byte[UefiConstants.SIZE_2];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, data, 0, UefiConstants.SIZE_2);
- subType += HexUtils.byteArrayToHexString(data);
- System.arraycopy(path, UefiConstants.OFFSET_6 + offset, data, 0, UefiConstants.SIZE_2);
- subType += " Port Multiplier = " + HexUtils.byteArrayToHexString(data);
- System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_2);
- subType += " Logical Unit Number = " + HexUtils.byteArrayToHexString(data);
- return subType;
- }
-
- /**
- * Processes the hard drive sub type.
- *
- * @param path
- * @param offset
- * @return hard drive info.
- */
- private String hardDriveSubType(final byte[] path, final int offset) {
- subType = "Partition Number = ";
- byte[] partnumber = new byte[UefiConstants.SIZE_4];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, partnumber, 0, UefiConstants.SIZE_4);
- subType += HexUtils.byteArrayToHexString(partnumber);
- byte[] data = new byte[UefiConstants.SIZE_8];
- System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_8);
- subType += " Partition Start = " + HexUtils.byteArrayToHexString(data);
- System.arraycopy(path, UefiConstants.OFFSET_16 + offset, data, 0, UefiConstants.SIZE_8);
- subType += " Partition Size = " + HexUtils.byteArrayToHexString(data);
- byte[] signature = new byte[UefiConstants.SIZE_16];
- System.arraycopy(path, UefiConstants.OFFSET_24 + offset, signature, 0, UefiConstants.SIZE_16);
- subType += "\n Partition Signature = ";
- if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_NONE) {
- subType += "None";
- } else if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_32BIT) {
- subType += HexUtils.byteArrayToHexString(signature);
- } else if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_GUID) {
- UefiGuid guid = new UefiGuid(signature);
- subType += guid.toString();
- } else {
- subType += "invalid partition signature type";
- }
- subType += " Partition Format = ";
- if (path[UefiConstants.OFFSET_40 + offset] == UefiConstants.DRIVE_TYPE_PC_AT) {
- subType += " PC-AT compatible legacy MBR";
- } else if (path[UefiConstants.OFFSET_40 + offset] == UefiConstants.DRIVE_TYPE_GPT) {
- subType += " GUID Partition Table";
- } else {
- subType += " Invalid partition table type";
- }
- return subType;
- }
-
- /**
- * Process the File path sub type.
- *
- * @param path
- * @param offset
- * @return file path info.
- */
- private String filePathSubType(final byte[] path, final int offset) {
- subType = "File Path = ";
- byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
- System.arraycopy(path, 2 + offset, lengthBytes, 0, UefiConstants.SIZE_2);
- int subTypeLength = HexUtils.leReverseInt(lengthBytes);
- byte[] filePath = new byte[subTypeLength];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, filePath, 0, subTypeLength);
- byte[] fileName = convertChar16tobyteArray(filePath);
- subType += new String(fileName, StandardCharsets.UTF_8);
- return subType;
- }
-
- /**
- * Process a vendor sub-type on a Media Type.
- * Length of this structure in bytes. Length is 20 + n bytes
- * Vendor-assigned GUID that defines the data that follows.
- * Vendor-defined variable size data.
- *
- * @param path
- * @param offset
- * @return vendor device info.
- */
- private String vendorSubType(final byte[] path, final int offset) {
- subType = "Vendor Subtype GUID = ";
- byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
- System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2);
- int subTypeLength = HexUtils.leReverseInt(lengthBytes);
- byte[] guidData = new byte[UefiConstants.SIZE_16];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16);
- UefiGuid guid = new UefiGuid(guidData);
- subType += guid.toString() + " ";
- if (subTypeLength - UefiConstants.SIZE_16 > 0) {
- byte[] vendorData = new byte[subTypeLength - UefiConstants.SIZE_16];
- System.arraycopy(path, UefiConstants.OFFSET_20
- + offset, vendorData, 0, subTypeLength - UefiConstants.SIZE_16);
- subType += " : Vendor Data = " + HexUtils.byteArrayToHexString(vendorData);
- } else {
- subType += " : No Vendor Data pesent";
- }
- return subType;
- }
-
- /**
- * Returns USB device info.
- * UEFI Specification, Version 2.8.
- *
- * @param path
- * @param offset
- * @return USB device info.
- */
- private String usbSubType(final byte[] path, final int offset) {
- subType = " USB ";
- subType += " port = " + Integer.valueOf(path[offset + UefiConstants.OFFSET_4]);
- subType += " interface = " + Integer.valueOf(path[offset + UefiConstants.OFFSET_5]);
- byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
- System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2);
- int subTypeLength = HexUtils.leReverseInt(lengthBytes);
- byte[] usbData = new byte[subTypeLength];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, usbData, 0, subTypeLength);
- // Todo add further USB processing ...
- return subType;
- }
-
- /**
- * Returns NVM device info.
- * UEFI Specification, Version 2.8.
- * Name space Identifier (NSID) and IEEE Extended Unique Identifier (EUI-64):
- * See Links to UEFI Related Documents
- * (http://uefi.org/uefi under the headings NVM Express Specification.
- *
- * @param path
- * @param offset
- * @return NVM device info.
- */
- private String nvmSubType(final byte[] path, final int offset) {
- subType = "NVM Express Namespace = ";
- byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
- System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2);
- int subTypeLength = HexUtils.leReverseInt(lengthBytes);
- byte[] nvmData = new byte[subTypeLength];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, nvmData, 0, subTypeLength);
- subType += HexUtils.byteArrayToHexString(nvmData);
- return subType;
- }
-
- /**
- * BIOS Device Type definition.
- * From Appendix A of the BIOS Boot Specification.
- * Only processes the Device type.
- * Status bootHandler pointer, and description String pointer are ignored.
- *
- * @param path byte array holding the device path.
- * @return String that represents the UEFI defined BIOS Device Type.
- */
- private String biosDevicePath(final byte[] path, final int offset) {
- subType = "Legacy BIOS : Type = ";
- Byte pathType = Byte.valueOf(path[offset + 1]);
- switch (pathType.intValue()) {
- case UefiConstants.DEVPATH_BIOS_RESERVED:
- subType += "Reserved";
- break;
- case UefiConstants.DEVPATH_BIOS_FLOPPY:
- subType += "Floppy";
- break;
- case UefiConstants.DEVPATH_BIOS_HD:
- subType += "Hard Disk";
- break;
- case UefiConstants.DEVPATH_BIOS_CD:
- subType += "CD-ROM";
- break;
- case UefiConstants.DEVPATH_BIOS_PCM:
- subType += "PCMCIA";
- break;
- case UefiConstants.DEVPATH_BIOS_USB:
- subType += "USB";
- break;
- case UefiConstants.DEVPATH_BIOS_EN:
- subType += "Embedded network";
- break;
- case UefiConstants.DEVPATH_BIOS_BEV:
- subType +=
- "Bootstrap Entry Vector (BEV) from an Option ROM";
- break;
- default:
- subType += "Unknown";
- break;
- }
- return subType;
- }
-
- /**
- * Returns PIWG firmware volume info.
- * UEFI Specification, Version 2.8.
- * PIWG Firmware File Section 10.3.5.6:
- * Contents are defined in the UEFI PI Specification.
- *
- * @param path
- * @param offset
- * @return String that represents the PIWG Firmware Volume Path
- */
- private String piwgFirmVolFile(final byte[] path, final int offset) {
- subType = "PIWG Firmware File ";
- byte[] guidData = new byte[UefiConstants.SIZE_16];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16);
- UefiGuid guid = new UefiGuid(guidData);
- subType += guid.toString();
- return subType;
- }
-
- /**
- * Returns PIWG firmware file info.
- * UEFI Specification, Version 2.8.
- * PIWG Firmware Volume Section 10.3.5.7:
- * Contents are defined in the UEFI PI Specification.
- *
- * @param path
- * @param offset
- * @return String that represents the PIWG Firmware Volume Path
- */
- private String piwgFirmVolPath(final byte[] path, final int offset) {
- subType = "PIWG Firmware Volume ";
- byte[] guidData = new byte[UefiConstants.SIZE_16];
- System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16);
- UefiGuid guid = new UefiGuid(guidData);
- subType += guid.toString();
- return subType;
- }
-
- /**
- * Returns a string that represents the UEFi Device path.
- *
- * @return UEFi Device path.
- */
- public String toString() {
- return devPathInfo;
- }
-
- /**
- * Converts from a char array to byte array.
- * Removes the upper byte (typically set to 0) of each char.
- *
- * @param data Character array.
- * @return byte array.
- */
- public static byte[] convertChar16tobyteArray(final byte[] data) {
- byte[] hexdata = new byte[data.length];
- int j = 0;
- for (int i = 0; i < data.length; i = i + UefiConstants.SIZE_2) {
- hexdata[j++] = data[i];
- }
- return hexdata;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiFirmware.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiFirmware.java
deleted file mode 100644
index 730c665d..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiFirmware.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import hirs.attestationca.utils.HexUtils;
-import lombok.Getter;
-
-import java.math.BigInteger;
-
-/**
- * Class to process the PFP defined UEFI_PLATFORM_FIRMWARE_BLOB structure.
- *
- * typedef struct tdUEFI_PLATFORM_FIRMWARE_BLOB {
- * UEFI_PHYSICAL_ADDRESS BlobBase;
- * UINT64 BlobLength;
- * } UEFI_PLATFORM_FIRMWARE_BLOB;
- */
-public class UefiFirmware {
- private boolean bError = false;
- /**
- * byte array holding the firmwares physical address.
- */
- private byte[] physicalAddress = null;
- /**
- * byte array holding the uefi address length.
- */
- private byte[] addressLength = null;
- /**
- * uefi physical address.
- */
- @Getter
- private int physicalBlobAddress = 0;
- /**
- * uefi address length.
- */
- @Getter
- private int blobLength = 0;
-
- /**
- * UefiFirmware constructor.
- *
- * @param blob byte array holding a Firmware Blob.
- */
- public UefiFirmware(final byte[] blob) {
- if (blob.length != UefiConstants.SIZE_16) {
- bError = true;
- } else {
- physicalAddress = new byte[UefiConstants.SIZE_8];
- addressLength = new byte[UefiConstants.SIZE_8];
- System.arraycopy(blob, 0, physicalAddress, 0, UefiConstants.SIZE_8);
- System.arraycopy(blob, UefiConstants.SIZE_8, addressLength, 0, UefiConstants.SIZE_8);
- byte[] lelength = HexUtils.leReverseByte(addressLength);
- BigInteger bigIntLength = new BigInteger(lelength);
- blobLength = bigIntLength.intValue();
- byte[] leAddress = HexUtils.leReverseByte(physicalAddress);
- BigInteger bigIntAddress = new BigInteger(leAddress);
- physicalBlobAddress = bigIntAddress.intValue();
- }
- }
-
- /**
- * Returns a description of the firmware blobs location.
- *
- * @return a description of the the firmware blobs location.
- */
- public String toString() {
- StringBuilder blobInfo = new StringBuilder();
- if (!bError) {
- blobInfo.append(String.format(" Platform Firmware Blob Address = %s",
- Integer.toHexString(physicalBlobAddress)));
- blobInfo.append(String.format(" length = %d", blobLength));
- } else {
- blobInfo.append(" Invalid Firmware Blob event encountered");
- }
- return blobInfo.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiGuid.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiGuid.java
deleted file mode 100644
index 9663af03..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiGuid.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import com.eclipsesource.json.JsonObject;
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.JsonUtils;
-
-import java.math.BigInteger;
-import java.nio.file.FileSystems;
-import java.nio.file.Path;
-import java.util.UUID;
-
-/**
- * Class to process GUID per the UEFI specification
- * GUIDs are essentially UUID as defined by RFC-1422, however Microsoft refers to GUIDS.
- */
-public class UefiGuid {
- /**
- * number of 100ns intervals since UUID Epoch.
- */
- private static final long UUID_EPOCH_INTERVALS = 0x01b21dd213814000L;
- /**
- * used for conversion to uuid time.
- */
- private static final int UUID_EPOCH_DIVISOR = 10000;
-
- private static final Path JSON_PATH = FileSystems.getDefault().getPath("/opt",
- "hirs", "default-properties", "vendor-table.json");
- private JsonObject uefiVendorRef;
- /**
- * guid byte array.
- */
- private byte[] guid;
- /**
- * UUID object.
- */
- private UUID uuid;
-
- /**
- * UefiGUID constructor.
- *
- * @param guidBytes byte array holding a valid guid.
- */
- public UefiGuid(final byte[] guidBytes) {
- guid = new byte[UefiConstants.SIZE_16];
- System.arraycopy(guidBytes, 0, guid, 0, UefiConstants.SIZE_16);
- uuid = processGuid(guidBytes);
- uefiVendorRef = JsonUtils.getSpecificJsonObject(JSON_PATH, "VendorTable");
- }
-
- /**
- * UefiGUID constructor.
- *
- * @param guidBytes byte array holding a valid guid.
- * @param vendorPathString string path for vendor
- */
- public UefiGuid(final byte[] guidBytes, final Path vendorPathString) {
- guid = new byte[UefiConstants.SIZE_16];
- System.arraycopy(guidBytes, 0, guid, 0, UefiConstants.SIZE_16);
- uuid = processGuid(guidBytes);
- uefiVendorRef = JsonUtils.getSpecificJsonObject(vendorPathString,
- "VendorTable");
- }
-
- /**
- * Converts a GUID with a byte array to a RFC-1422 UUID object.
- * Assumes a MS format and converts to Big Endian format used by most others , including Linux
- * Matched uuids found in /sys/firmware/efi/efivars on Centos 7.
- */
- private static UUID processGuid(final byte[] guid) {
- byte[] msb1 = new byte[UefiConstants.SIZE_4];
- System.arraycopy(guid, 0, msb1, 0, UefiConstants.SIZE_4);
- byte[] msb1r = HexUtils.leReverseByte(msb1);
- byte[] msb2 = new byte[UefiConstants.SIZE_4];
- System.arraycopy(guid, UefiConstants.OFFSET_4, msb2, 0, UefiConstants.SIZE_4);
- byte[] msb2r = HexUtils.leReverseByte(msb2);
- byte[] msb2rs = new byte[UefiConstants.SIZE_4];
- System.arraycopy(msb2r, 0, msb2rs, UefiConstants.OFFSET_2, UefiConstants.SIZE_2);
- System.arraycopy(msb2r, UefiConstants.OFFSET_2, msb2rs, 0, UefiConstants.SIZE_2);
- byte[] msbt = new byte[UefiConstants.SIZE_8];
- System.arraycopy(msb1r, 0, msbt, 0, UefiConstants.SIZE_4);
- System.arraycopy(msb2rs, 0, msbt, UefiConstants.OFFSET_4, UefiConstants.SIZE_4);
- long msbl = new BigInteger(msbt).longValue();
- byte[] lsb = new byte[UefiConstants.SIZE_8];
- System.arraycopy(guid, UefiConstants.OFFSET_8, lsb, 0, UefiConstants.SIZE_8);
- long lsbl = new BigInteger(lsb).longValue();
- return new UUID(msbl, lsbl);
- }
-
- /**
- * Returns the standard GUID length.
- *
- * @return guid length
- */
- public static int getGuidLength() {
- return UefiConstants.SIZE_16;
- }
-
- /**
- * Returns a String that represents a specification name referenced by the
- * EFI_CONFIGURATION_TABLE VendorGUID field. For structure of
- * EFI_CONFIGURATION_TABLE type, the UEFI specification has set of GUIDs
- * published that represent standards that one can find further information on
- * the configuration table being referenced.
- * Refer to section 4.6 of UEFI spec v 2.8, page 101.
- *
- * @return A String of major UUID parameters
- */
- public String getVendorTableReference() {
- return getVendorTableReference(uuid.toString().toLowerCase());
- }
-
- /**
- * Returns a String that represents a specification name referenced by the
- * EFI_CONFIGURATION_TABLE VendorGUID field. For structure of
- * EFI_CONFIGURATION_TABLE type, the UEFI specification has set of GUIDs
- * published that represent standards that one can find further
- * information on the configuration table being referenced.
- * Refer to section 4.6 of UEFI spec v 2.8, page 101.
- *
- * @param lookupValue specific value to look up
- * @return A String of major UUID parameters
- */
- public String getVendorTableReference(final String lookupValue) {
- return uefiVendorRef.getString(lookupValue, "Unknown GUID reference");
- }
-
- /**
- * Returns a string of the entity that the UUID represents.
- * Contains a Vendor String lookup on the UUID.
- *
- * @return UUID description.
- */
- public String toString() {
- return String.format("%s : %s", uuid.toString(), getVendorTableReference());
- }
-
- /**
- * Returns a string of the entity that the UUID represents.
- * Does not contain a vendor lookup on the UUID.
- *
- * @return UUID description.
- */
- public String toStringNoLookup() {
- return uuid.toString();
- }
-
- /**
- * Returns a string of the entity that the UUID represents.
- * Does not contain a vendor lookup on the UUID.
- *
- * @param guid byte array holding the guid data.
- * @return true if the UUID has a valid structure.
- */
- public static boolean isValidUUID(final byte[] guid) {
- boolean valid = false;
- UUID tmpUuid = processGuid(guid);
- if (tmpUuid.toString().length() != 0) {
- valid = true;
- }
- return valid;
- }
-
- /**
- * Checks to see if the uuid is the test or Empty UUID ("00000000-0000-0000-0000-000000000000").
- *
- * @return true if the uuid is the Empty UUID, false if not
- */
- public boolean isEmptyUUID() {
- return uuid.toString().equals("00000000-0000-0000-0000-000000000000");
- }
-
- /**
- * Checks to see if the uuid is the Empty UUID or an unknown.
- *
- * @return true if the uuid is the Empty UUID, false if not
- */
- public boolean isUnknownUUID() {
- if (getVendorTableReference().equals("Unknown GUID reference")) {
- return true;
- }
- return false;
- }
-
- /**
- * Retrieves the timestamp within a time based GUID.
- *
- * @param uuid uuid object
- * @return long representing the time stamp from the GUID
- */
- public long getTimeFromUUID(final UUID uuid) {
- return (uuid.timestamp() - UUID_EPOCH_INTERVALS) / UUID_EPOCH_DIVISOR;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiPartition.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiPartition.java
deleted file mode 100644
index 94b9ec8b..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiPartition.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import hirs.attestationca.utils.HexUtils;
-import lombok.Getter;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * Class to process EFI Partitions for EFI Partition tables defined in UEFI section 5.3.3
- * typedef struct {
- * EFI_GUID PartitionTypeGUID;
- * EFI_GUID UniquePartitionGUID;
- * EFI_LBA StartingLBA; // Same as UINT64.
- * EFI_LBA EndingLBA;
- * UINT64 Attributes;
- * CHAR16 PartitionName[36]; // 36 CHAR16 = 72 Bytes
- * } EFI_PARTITION_ENTRY;
- *
- * UEFI Table 23. Defined GPT Partition Entry - Partition Type GUIDs (implemented in EFIGui.java)
- * Examples:
- * Unused Entry 00000000-0000-0000-0000-000000000000
- * EFI System Partition C12A7328-F81F-11D2-BA4B-00A0C93EC93B
- * Partition containing a legacy MBR 024DEE41-33E7-11D3-9D69-0008C781F39F
- * Linux filesystem data 0FC63DAF-8483-4772-8E79-3D69D8477DE4
- * Logical Volume Manager (LVM) partition E6D6D379-F507-44C2-A23C-238F2A3DF928
- * Plain dm-crypt partition 7FFEC5C9-2D00-49B7-8941-3EA10A5586B7
- * Root partition (x86-64) 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
- * RAID partition A19D880F-05FC-4D3B-A006-743F0F84911E
- * LUKS partition CA7D7CCB-63ED-4C53-861C-1742536059CC
- *
- * linux commands to check uuids:
- * blkid list //unique parition guids
- * ls /dev/disk/by-partuuid
- */
-@Getter
-public class UefiPartition {
- private UefiGuid partitionTypeGUID = null;
- private UefiGuid uniquePartitionGUID = null;
- private String partitionName = "";
- private String attributes = "";
-
- /**
- * Processes a UEFI defined partition entry.
- *
- * @param table byte array holding the partition table.
- */
- public UefiPartition(final byte[] table) {
- byte[] partitionGuidBytes = new byte[UefiConstants.SIZE_16];
- System.arraycopy(table, 0, partitionGuidBytes, 0, UefiConstants.SIZE_16);
- partitionTypeGUID = new UefiGuid(partitionGuidBytes);
- byte[] uniquePartGuidBytes = new byte[UefiConstants.SIZE_16];
- System.arraycopy(table, UefiConstants.SIZE_16, uniquePartGuidBytes, 0, UefiConstants.SIZE_16);
- uniquePartitionGUID = new UefiGuid(uniquePartGuidBytes);
- byte[] attributeBytes = new byte[UefiConstants.SIZE_8];
- System.arraycopy(table, UefiConstants.ATTRIBUTE_LENGTH, attributeBytes,
- 0, UefiConstants.SIZE_8);
- attributes = HexUtils.byteArrayToHexString(attributeBytes);
- byte[] partitionNameBytes = new byte[UefiConstants.UEFI_PT_LENGTH];
- System.arraycopy(table, UefiConstants.PART_NAME_LENGTH, partitionNameBytes,
- 0, UefiConstants.UEFI_PT_LENGTH);
- byte[] pName = convertChar16tobyteArray(partitionNameBytes);
- partitionName = new String(pName, StandardCharsets.UTF_8).trim();
- }
-
- /**
- * Returns a description of the partition.
- *
- * @return partition description.
- */
- public String toString() {
- String partitionInfo = "";
- partitionInfo += " Partition Name : " + partitionName + "\n";
- partitionInfo += " Partition Type GUID : " + partitionTypeGUID.toString() + "\n";
- partitionInfo += " Unique Partition GUID : " + uniquePartitionGUID.toStringNoLookup() + "\n";
- partitionInfo += " Attributes : " + attributes;
- return partitionInfo;
- }
-
- /**
- * Copies character array to a byte by removing upper byte of character array.
- *
- * @param data input char array
- * @return byte array
- */
- private byte[] convertChar16tobyteArray(final byte[] data) {
- byte[] hexdata = new byte[data.length];
- int j = 0;
- for (int i = 0; i < data.length; i += 2) {
- hexdata[j++] = data[i];
- }
- return hexdata;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSecureBoot.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSecureBoot.java
deleted file mode 100644
index 3afdfabc..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSecureBoot.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import lombok.Getter;
-
-import java.math.BigInteger;
-
-/**
- * Class that processes the UEFI defined SecureBoot Variable.
- * Currently this variable only specifies if SecureBoot is on/off.
- */
-public class UefiSecureBoot {
- /**
- * Variable value.
- */
- @Getter
- private int secureBootVariable = 0;
- /**
- * Error flag.
- */
- private boolean berror = false;
- /**
- * Human readable description.
- */
- private String info = "";
-
- /**
- * Constructor to process the EFI Secure Boot Variable.
- *
- * @param data UEFI variable data.
- */
- public UefiSecureBoot(final byte[] data) {
- if (data.length == 0) {
- berror = true;
- info = "Unknown State: Empty Secure Boot variable\n";
- } else {
- secureBootVariable = new BigInteger(data).intValue();
- }
- }
-
- /**
- * Provides a human readable value for the Secure Boot variable.
- *
- * @return Human readable description.
- */
- public String toString() {
- if (!berror) {
- if (secureBootVariable == 1) {
- info += " Secure Boot is enabled ";
- } else if (secureBootVariable == 0) {
- info += " Secure Boot is NOT enabled ";
- } else {
- info += " Unkown State: Secure Variable is undefined ";
- }
- }
- return info;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureData.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureData.java
deleted file mode 100644
index d601b6da..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureData.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import hirs.attestationca.utils.HexUtils;
-import lombok.Getter;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-
-/**
- * Class for processing the contents of a Secure Boot DB or DBX contents.
- * used for EFIVariables associated with Secure Boot
- * as defined by Section 32.4.1 Signature Database from the UEFI 2.8 specification
- *
- * typedef struct _EFI_SIGNATURE_DATA {
- * EFI_GUID SignatureOwner;
- * UINT8 SignatureData[...];
- * } EFI_SIGNATURE_DATA;
- *
- * However page 1729 0f UEFI 2.8 implies that SignatureListType of EFI_CERT_SHA256_GUID
- * will contain the "the SHA-256 hash of the binary".
- * So the Signature Data depends upon the Signature Type from the EFI Signature List.
- */
-public class UefiSignatureData {
- /**
- * UEFI Certificate GUID.
- */
- private byte[] guid = new byte[UefiConstants.SIZE_16];
- /**
- * UEFI Signature data.
- */
- private byte[] sigData = null;
- /**
- * UEFI Certificate object .
- */
- @Getter
- private UefiX509Cert cert = null;
- /**
- * UEFI Certificate GUID.
- */
- @Getter
- private UefiGuid efiVarGuid = null;
- /**
- * UEFI Signature type.
- */
- @Getter
- private UefiGuid signatureType = null;
- /**
- * UEFI Signature validity.
- */
- @Getter
- private boolean valid = false;
- /**
- * UEFI Certificate SHA1 hash.
- */
- private byte[] binaryHash = new byte[UefiConstants.SIZE_40];
- /**
- * UEFI Signature data status.
- */
- @Getter
- private String status = "Signature Data contains a valid Certificate";
-
- /**
- * UefiSignatureData constructor.
- *
- * @param inputStream The Signature data.
- * @param sigType UEFI defined signature type.
- * @throws java.io.IOException if there's an problem reading the input stream.
- * @throws java.security.cert.CertificateException If there a problem parsing the X509 certificate.
- * @throws java.security.NoSuchAlgorithmException if there's a problem hashing the certificate.
- */
- UefiSignatureData(final ByteArrayInputStream inputStream, final UefiGuid sigType)
- throws IOException, CertificateException, NoSuchAlgorithmException {
- signatureType = sigType;
- // UEFI spec section 32.5.3.3 states that SignatureListType of EFI_CERT_SHA256_GUID
- // only contains a hash, not a cert
- if (sigType.getVendorTableReference().equals("EFI_CERT_SHA256_GUID")) {
- inputStream.read(guid);
- efiVarGuid = new UefiGuid(guid);
- // Should be a SHA256 hash of the "binary"
- inputStream.read(binaryHash);
- } else if (sigType.getVendorTableReference().equals("EFI_CERT_X509_GUID")) {
- inputStream.read(guid);
- efiVarGuid = new UefiGuid(guid);
- // Read in Type and Length separately so we calculate the rest of the cert size
- byte[] certType = new byte[UefiConstants.SIZE_2];
- inputStream.read(certType);
- byte[] certLength = new byte[UefiConstants.SIZE_2];
- inputStream.read(certLength);
- int cLength = new BigInteger(certLength).intValue() + UefiConstants.SIZE_4;
- byte[] certData = new byte[cLength];
- inputStream.read(certData);
- // put the cert back together
- byte[] certBlob = new byte[cLength + UefiConstants.SIZE_4];
- System.arraycopy(certType, 0, certBlob, 0, UefiConstants.SIZE_2);
- System.arraycopy(certLength, 0, certBlob, UefiConstants.OFFSET_2, UefiConstants.SIZE_2);
- System.arraycopy(certData, 0, certBlob, UefiConstants.OFFSET_4, cLength);
- cert = new UefiX509Cert(certBlob);
- } else if (sigType.isUnknownUUID()) {
- //status = "Signature List Type has an unknown GUID: " + efiGuid.toString();
- status = "Signature List Type has an unknown GUID";
- return;
- } else { // else process as a cert (RH SHIM does this)
- processC509Cert(inputStream);
- efiVarGuid = sigType;
- }
- valid = true;
- }
-
- /**
- * Default EFISignatureData Constructor.
- *
- * @param data byte array of the EFISignatureData to process
- * @throws java.security.cert.CertificateException If there a problem parsing the X509 certificate.
- * @throws java.security.NoSuchAlgorithmException if there's a problem hashing the certificate.
- */
- UefiSignatureData(final byte[] data) throws CertificateException, NoSuchAlgorithmException {
- System.arraycopy(data, 0, guid, 0, UefiConstants.SIZE_16);
- sigData = new byte[data.length - UefiConstants.SIZE_16];
- System.arraycopy(data, UefiConstants.OFFSET_16, sigData, 0, data.length - UefiConstants.SIZE_16);
- cert = new UefiX509Cert(sigData);
- efiVarGuid = new UefiGuid(guid);
- }
-
- /**
- * Processes an x509 Cert used by secure DB or DBx.
- *
- * @param inputStream x509 certificate data.
- * @throws java.io.IOException is there's a problem reading the data.
- * @throws java.security.cert.CertificateException if there's a problem parsing the certificate.
- * @throws java.security.NoSuchAlgorithmException if there's a problem creating a hash.
- */
- private void processC509Cert(final ByteArrayInputStream inputStream)
- throws IOException, CertificateException, NoSuchAlgorithmException {
- byte[] certType = new byte[UefiConstants.SIZE_2];
- inputStream.read(certType);
- byte[] certLength = new byte[UefiConstants.SIZE_2];
- inputStream.read(certLength);
- int cLength = new BigInteger(certLength).intValue() + UefiConstants.SIZE_4;
- byte[] certData = new byte[cLength];
- inputStream.read(certData);
- // put the cert back together
- byte[] certBlob = new byte[cLength + UefiConstants.SIZE_4];
- System.arraycopy(certType, 0, certBlob, 0, 2);
- System.arraycopy(certLength, 0, certBlob, 2, 2);
- System.arraycopy(certData, 0, certBlob, UefiConstants.OFFSET_4, cLength);
- cert = new UefiX509Cert(certBlob);
- }
-
- /**
- * Provides a description of the fields within the EFI Signature Data.
- *
- * @return X509Cert human readable description.
- */
- public String toString() {
- String sigInfo = "";
- if (!valid) {
- sigInfo = status;
- } else {
- if (signatureType.getVendorTableReference().equals("EFI_CERT_SHA256_GUID")) {
- sigInfo += "UEFI Signature Owner = " + efiVarGuid.toString() + "\n";
- sigInfo += " Binary Hash = " + HexUtils.byteArrayToHexString(binaryHash) + "\n";
- } else {
- sigInfo += "UEFI Signature Owner = " + efiVarGuid.toString() + "\n";
- sigInfo += cert.toString();
- }
- }
- return sigInfo;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureList.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureList.java
deleted file mode 100644
index f508b311..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/uefi/UefiSignatureList.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog.uefi;
-
-import hirs.attestationca.utils.HexUtils;
-import lombok.Getter;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-
-/**
- * Class for processing the contents of a Secure Boot DB or DBX contents.
- * used for EFIVariables associated with Secure Boot
- * as defined by Section 32.4.1 Signature Database from the UEFI 2.8 specification.
- *
- * An EFI Signature List is actual a list of Certificates used to verify a Signature.
- * This is mainly found in PCR[7] UEFI variables for the Secure Boot PK, KEK, Db and DBx variables.
- *
- * typedef struct _EFI_SIGNATURE_LIST {
- * EFI_GUID SignatureType;
- * UINT32 SignatureListSize;
- * UINT32 SignatureHeaderSize;
- * UINT32 SignatureSize;
- * // UINT8 SignatureHeader[SignatureHeaderSize];
- * // EFI_SIGNATURE_DATA Signatures[...][SignatureSize];
- * } EFI_SIGNATURE_LIST;
- */
-public class UefiSignatureList {
- /**
- * Size of the signature list.
- */
- private int listSize = 0;
- /**
- * Size of a signature.
- */
- private int signatureSize = 0;
- /**
- * Signature data.
- */
- private byte[] sigData = null;
- /**
- * Number of Items in the list.
- */
- @Getter
- private int numberOfCerts = 0;
- /**
- * Signature validity.
- */
- private boolean valid = true;
- /**
- * Current status.
- */
- private String status = "Signature List is Valid";
- /**
- * Array List of Signature found in the list.
- */
- private ArrayList Java class for BaseElement complex type.
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * the map is keyed by the name of the attribute and
- * the value is the string value of the attribute.
- *
- * the map returned by this method is live, and you can add new attribute
- * by updating the map directly. Because of this design, there's no setter.
- *
- *
- * @return
- * always non-null
- */
- public Map Java class for CanonicalizationMethodType complex type.
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- * Policy
class represents a policy. This is an abstract class
- * for representing the rules for which an Appraiser
should
- * evaluate a Report
. A typical Policy
will contain a
- * Baseline
at the very least. A Policy
is identified
- * by its name, so the name for a Policy
must be unique.
- */
-@Inheritance(strategy = InheritanceType.JOINED)
-@Access(AccessType.FIELD)
-@MappedSuperclass
-public abstract class Policy extends UserDefinedEntity {
-
- /**
- * Default empty constructor is required for Hibernate. It is protected to
- * prevent code from calling it directly.
- */
- protected Policy() {
- super();
- }
-
- /**
- * Creates a new Policy
with the specified name.
- *
- * @param name
- * name
- */
- public Policy(final String name) {
- super(name);
- }
-
- /**
- * Creates a new Policy
with the specified name and
- * description.
- *
- * @param name
- * name (required)
- * @param description
- * description (may be null)
- */
- public Policy(final String name, final String description) {
- super(name, description);
- }
-
- /**
- * Returns true if this object has been persisted. Used in determining whether
- * an Appraiser should request the full Policy (and baselines) for appraisal
- *
- * @return true if this object has been persisted; false otherwise
- */
- public final boolean isPersisted() {
- return getId() != null;
- }
-
- /**
- * When {@link hirs.attestationca.portal.persist.entity.Policy} are serialized to be sent to the browser, this can be used
- * to determine the type of {@link hirs.attestationca.portal.persist.entity.Policy}.
- *
- * @return The class name for the {@link hirs.attestationca.portal.persist.entity.Policy}
- */
- public String getType() {
- return this.getClass().getSimpleName();
- }
-}
-
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/UserDefinedEntity.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/UserDefinedEntity.java
deleted file mode 100644
index e07f82c4..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/UserDefinedEntity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package hirs.attestationca.portal.persist.entity;
-
-
-import jakarta.persistence.Column;
-import jakarta.persistence.MappedSuperclass;
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * An abstract archivable entity that can be given a user-defined name and description.
- */
-@Getter
-@Setter
-@EqualsAndHashCode(callSuper = false)
-@AllArgsConstructor
-@MappedSuperclass
-public abstract class UserDefinedEntity extends ArchivableEntity {
-
- @Column(nullable = false, unique = true)
- private String name;
-
- @ToString.Exclude
- @EqualsAndHashCode.Exclude
- @Column(nullable = false, unique = false)
- private String description = "";
-
- /**
- * Default empty constructor is required for Hibernate. It is protected to
- * prevent code from calling it directly.
- */
- protected UserDefinedEntity() {
- super();
- }
-
- /**
- * Creates a new entity with the specified name.
- *
- * @param name name
- */
- public UserDefinedEntity(final String name) {
- this(name, "");
- }
-}
-
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/manager/DeviceRepository.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/manager/DeviceRepository.java
deleted file mode 100644
index 8e5ad090..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/manager/DeviceRepository.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package hirs.attestationca.portal.persist.entity.manager;
-
-import hirs.attestationca.persist.entity.userdefined.Device;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.UUID;
-
-@Repository
-public interface DeviceRepository extends JpaRepositoryReport
represents an integrity report to be appraised by an
- * Appraiser
. An Appraiser
validates the integrity of
- * a client's platform with an integrity report. Example reports include an IMA
- * report and TPM report.
- * Report
class contains minimal information because each
- * report is vastly different. There is an identification number in case the
- * Report
is stored in a database, and there is a report type. The
- * report type is used to determine which Appraiser
s can appraise
- * the report.
- */
-@Entity
-@Access(AccessType.FIELD)
-@Inheritance(strategy = InheritanceType.JOINED)
-public abstract class Report extends AbstractEntity {
- /**
- * Default constructor.
- */
- protected Report() {
- super();
- }
-
- /**
- * Returns a String
that indicates this report type. The report
- * type is used to find an Appraiser
that can appraise this
- * Report
.
- *
- * @return report type
- */
- public abstract String getReportType();
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/SupplyChainSettings.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/SupplyChainSettings.java
deleted file mode 100644
index 9caff3b3..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/SupplyChainSettings.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined;
-
-import hirs.attestationca.persist.entity.UserDefinedEntity;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Table;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class represents Supply Chain policy. Supply Chain Policy identifies the methods in
- * SupplyChainValidator that should be used in order to validate a supply chain.
- * By default, the policy does not enable any validations.
- */
-@Table(name = "SupplyChainSettings")
-@Getter
-@Setter
-@Entity
-@ToString(callSuper = true)
-public class SupplyChainSettings extends UserDefinedEntity {
- /**
- * Name of the default Supply Chain Policy.
- */
- public static final String DEFAULT_POLICY = "Default Supply Chain Policy";
- /**
- * Number of days in 10 years.
- */
- public static final String TEN_YEARS = "3651";
- /**
- * Number of days in 1 year.
- */
- public static final String YEAR = "365";
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean ecValidationEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean pcValidationEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean pcAttributeValidationEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean firmwareValidationEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean utcValidationEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean expiredCertificateValidationEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean replaceEC = false;
-
- @Column(nullable = false, columnDefinition = "boolean default true")
- private boolean issueAttestationCertificate = true;
-
- @Column(nullable = false, columnDefinition = "boolean default true")
- private boolean issueDevIdCertificate = true;
-
- @Column(nullable = false)
- private String validityDays = TEN_YEARS;
-
- @Column(nullable = false)
- private String devIdValidityDays = TEN_YEARS;
-
- @Column(nullable = false)
- private String reissueThreshold = YEAR;
-
- @Column(nullable = false)
- private String devIdReissueThreshold = YEAR;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean generateOnExpiration = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean devIdExpirationFlag = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean ignoreImaEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean ignoretBootEnabled = false;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean linuxOs = false;
-
- @Column(nullable = false, columnDefinition = "boolean default true")
- private boolean ignoreGptEnabled = true;
-
- @Column(nullable = false, columnDefinition = "boolean default false")
- private boolean ignoreOsEvtEnabled = false;
-
- /**
- * Default constructor necessary for Hibernate.
- */
- protected SupplyChainSettings() {
- super();
- }
-
- /**
- * Constructor used to initialize SupplyChainSettings object.
- *
- * @param name
- * A name used to uniquely identify and reference the Supply Chain policy.
- */
- public SupplyChainSettings(final String name) {
- super(name);
- }
-
- /**
- * Constructor used to initialize SupplyChainSettings object.
- *
- * @param name
- * A name used to uniquely identify and reference the supply chain policy.
- * @param description
- * Optional description of the policy that can be added by the user
- */
- public SupplyChainSettings(final String name, final String description) {
- super(name, description);
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java
deleted file mode 100644
index 6eda4a10..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateAuthorityCredential.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate;
-
-import hirs.attestationca.persist.entity.userdefined.Certificate;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import lombok.Getter;
-import org.apache.commons.codec.binary.Hex;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.Arrays;
-
-/**
- * This class persists Certificate Authority credentials by extending the base Certificate
- * class with fields unique to CA credentials.
- */
-@Entity
-public class CertificateAuthorityCredential extends Certificate {
-
-
- @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
- private static final String SUBJECT_KEY_IDENTIFIER_EXTENSION = "2.5.29.14";
-
- /**
- * Holds the name of the 'subjectKeyIdentifier' field.
- */
- public static final String SUBJECT_KEY_IDENTIFIER_FIELD = "subjectKeyIdentifier";
-
- private static final int CA_BYTE_SIZE = 20;
- private static final int PREFIX_BYTE_SIZE = 4;
-
- @Column
- private final byte[] subjectKeyIdentifier;
-
- @Getter
- @Column
- private String subjectKeyIdString;
-
- /**
- * this field is part of the TCG CA specification, but has not yet been found in
- * manufacturer-provided CAs, and is therefore not currently parsed.
- */
- @Getter
- @Column
- private final String credentialType = "TCPA Trusted Platform Module Endorsement";
-
- /**
- * Construct a new CertificateAuthorityCredential given its binary contents. The given
- * certificate should represent either an X509 certificate or X509 attribute certificate.
- *
- * @param certificateBytes the contents of a certificate file
- * @throws java.io.IOException if there is a problem extracting information from the certificate
- */
- public CertificateAuthorityCredential(final byte[] certificateBytes)
- throws IOException {
- super(certificateBytes);
- byte[] tempBytes = getX509Certificate()
- .getExtensionValue(SUBJECT_KEY_IDENTIFIER_EXTENSION);
-
- if (tempBytes != null && tempBytes.length > CA_BYTE_SIZE) {
- this.subjectKeyIdentifier = truncatePrefixBytes(tempBytes);
- } else {
- this.subjectKeyIdentifier =
- getX509Certificate().getExtensionValue(SUBJECT_KEY_IDENTIFIER_EXTENSION);
- }
-
- if (this.subjectKeyIdentifier != null) {
- this.subjectKeyIdString = Hex.encodeHexString(this.subjectKeyIdentifier);
- }
- }
-
- /**
- * Construct a new CertificateAuthorityCredential by parsing the file at the given path.
- * The given certificate should represent either an X509 certificate or X509 attribute
- * certificate.
- *
- * @param certificatePath the path on disk to a certificate
- * @throws java.io.IOException if there is a problem reading the file
- */
- public CertificateAuthorityCredential(final Path certificatePath)
- throws IOException {
- super(certificatePath);
- byte[] tempBytes = getX509Certificate()
- .getExtensionValue(SUBJECT_KEY_IDENTIFIER_EXTENSION);
-
- if (tempBytes.length > CA_BYTE_SIZE) {
- this.subjectKeyIdentifier = truncatePrefixBytes(tempBytes);
- } else {
- this.subjectKeyIdentifier =
- getX509Certificate().getExtensionValue(SUBJECT_KEY_IDENTIFIER_EXTENSION);
- }
- if (this.subjectKeyIdentifier != null) {
- this.subjectKeyIdString = Hex.encodeHexString(this.subjectKeyIdentifier);
- }
- }
-
- /**
- * Default constructor for Hibernate.
- */
- protected CertificateAuthorityCredential() {
- subjectKeyIdentifier = null;
- }
-
- /**
- * @return this certificate's subject key identifier.
- */
- public byte[] getSubjectKeyIdentifier() {
- if (subjectKeyIdentifier != null) {
- return subjectKeyIdentifier.clone();
- }
- return null;
- }
-
- private byte[] truncatePrefixBytes(final byte[] certificateBytes) {
- byte[] temp = new byte[CA_BYTE_SIZE];
- System.arraycopy(certificateBytes, PREFIX_BYTE_SIZE, temp, 0, CA_BYTE_SIZE);
-
- return temp;
- }
-
- @Override
- @SuppressWarnings("checkstyle:avoidinlineconditionals")
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- if (!super.equals(o)) {
- return false;
- }
-
- CertificateAuthorityCredential that = (CertificateAuthorityCredential) o;
-
-// if (!Objects.equals(credentialType, that.credentialType)) {
-// return false;
-// }
-
- return Arrays.equals(subjectKeyIdentifier, that.subjectKeyIdentifier);
- }
-
- @Override
- @SuppressWarnings({"checkstyle:magicnumber", "checkstyle:avoidinlineconditionals"})
- public int hashCode() {
- int result = super.hashCode();
- result = 31 * result + (credentialType != null ? credentialType.hashCode() : 0);
- result = 31 * result + Arrays.hashCode(subjectKeyIdentifier);
- return result;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateVariables.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateVariables.java
deleted file mode 100644
index c8a9c774..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/CertificateVariables.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate;
-
-public class CertificateVariables {
-
- public static final String PEM_HEADER = "-----BEGIN CERTIFICATE-----";
- public static final String PEM_FOOTER = "-----END CERTIFICATE-----";
- public static final String PEM_ATTRIBUTE_HEADER = "-----BEGIN ATTRIBUTE CERTIFICATE-----";
- public static final String PEM_ATTRIBUTE_FOOTER = "-----END ATTRIBUTE CERTIFICATE-----";
- public static final String MALFORMED_CERT_MESSAGE = "Malformed certificate detected.";
- public static final int MAX_CERT_LENGTH_BYTES = 2048;
- public static final int MAX_NUMERIC_PRECISION = 49; // Can store up to 160 bit values
- public static final int MAX_PUB_KEY_MODULUS_HEX_LENGTH = 1024;
- public static final int KEY_USAGE_BIT0 = 0;
- public static final int KEY_USAGE_BIT1 = 1;
- public static final int KEY_USAGE_BIT2 = 2;
- public static final int KEY_USAGE_BIT3 = 3;
- public static final int KEY_USAGE_BIT4 = 4;
- public static final int KEY_USAGE_BIT5 = 5;
- public static final int KEY_USAGE_BIT6 = 6;
- public static final int KEY_USAGE_BIT7 = 7;
- public static final int KEY_USAGE_BIT8 = 8;
- public static final String KEY_USAGE_DS = "DIGITAL SIGNATURE";
- public static final String KEY_USAGE_NR = "NON-REPUDIATION";
- public static final String KEY_USAGE_KE = "KEY ENCIPHERMENT";
- public static final String KEY_USAGE_DE = "DATA ENCIPHERMENT";
- public static final String KEY_USAGE_KA = "KEY AGREEMENT";
- public static final String KEY_USAGE_KC = "KEY CERT SIGN";
- public static final String KEY_USAGE_CS = "CRL SIGN";
- public static final String KEY_USAGE_EO = "ENCIPHER ONLY";
- public static final String KEY_USAGE_DO = "DECIPHER ONLY";
- public static final String ECDSA_OID = "1.2.840.10045.4.3.2";
- public static final String ECDSA_SHA224_OID = "1.2.840.10045.4.1";
- public static final String RSA256_OID = "1.2.840.113549.1.1.11";
- public static final String RSA384_OID = "1.2.840.113549.1.1.12";
- public static final String RSA512_OID = "1.2.840.113549.1.1.13";
- public static final String RSA224_OID = "1.2.840.113549.1.1.14";
- public static final String RSA512_224_OID = "1.2.840.113549.1.1.15";
- public static final String RSA512_256_OID = "1.2.840.113549.1.1.16";
- public static final String RSA256_STRING = "SHA256WithRSA";
- public static final String RSA384_STRING = "SHA384WithRSA";
- public static final String RSA224_STRING = "SHA224WithRSA";
- public static final String RSA512_STRING = "SHA512WithRSA";
- public static final String RSA512_224_STRING = "SHA512-224WithRSA";
- public static final String RSA512_256_STRING = "SHA512-256WithRSA";
- public static final String ECDSA_STRING = "SHA256WithECDSA";
- public static final String ECDSA_SHA224_STRING = "SHA224WithECDSA";
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/ConformanceCredential.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/ConformanceCredential.java
deleted file mode 100644
index 3df74cdb..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/ConformanceCredential.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate;
-
-import hirs.attestationca.persist.entity.userdefined.Certificate;
-import jakarta.persistence.Entity;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-import java.io.IOException;
-import java.nio.file.Path;
-
-/**
- * This class persists Conformance credentials by extending the base Certificate
- * class with fields unique to Conformance credentials.
- */
-@NoArgsConstructor(access= AccessLevel.PROTECTED)
-@Entity
-public class ConformanceCredential extends Certificate {
- /**
- * This class enables the retrieval of ConformanceCredentials by their attributes.
- */
-// public static class Selector extends CertificateSelector
- * CommonCriteriaMeasures ::= SEQUENCE {
- * version IA5STRING (SIZE (1..STRMAX)), "2.2" or "3.1";
- * assurancelevel EvaluationAssuranceLevel,
- * evaluationStatus EvaluationStatus,
- * plus BOOLEAN DEFAULT FALSE,
- * strengthOfFunction [0] IMPLICIT StrengthOfFunction OPTIONAL,
- * profileOid [1] IMPLICIT OBJECT IDENTIFIER OPTIONAL,
- * profileUri [2] IMPLICIT URIReference OPTIONAL,
- * targetOid [3] IMPLICIT OBJECT IDENTIFIER OPTIONAL,
- * targetUri [4] IMPLICIT URIReference OPTIONAL }
- *
- */
-@Getter @Setter
-public class CommonCriteriaMeasures {
-
- private static final int STRENGTH_OF_FUNCTION = 0;
- private static final int PROFILE_OID = 1;
- private static final int PROFILE_URI = 2;
- private static final int TARGET_OID = 3;
- private static final int TARGET_URI = 4;
-
- /**
- * A type to handle the evaluation status used in the Common Criteria Measurement.
- * Ordering of enum types is intentional and their ordinal values correspond to enum
- * values in the TCG spec.
- *
- *
- * EvaluationStatus ::= ENUMERATED {
- * designedToMeet (0),
- * evaluationInProgress (1),
- * evaluationCompleted (2) }
- *
- */
- public enum EvaluationStatus {
- /**
- * Evaluation designed to meet.
- */
- DESIGNEDTOMEET("designed To Meet"),
- /**
- * Evaluation in progress.
- */
- EVALUATIONINPROGRESS("evaluation In Progress"),
- /**
- * Evaluation completed.
- */
- EVALUATIONCOMPLETED("evaluation Completed");
-
- @Getter
- private final String value;
-
- /**
- * Basic constructor.
- * @param value string containing the value.
- */
- EvaluationStatus(final String value) {
- this.value = value;
- }
- }
-
- /**
- * A type to handle the strength of function used in the Common Criteria Measurement.
- * Ordering of enum types is intentional and their ordinal values correspond to enum
- * values in the TCG spec.
- *
- *
- * StrengthOfFunction ::= ENUMERATED {
- * basic (0),
- * medium (1),
- * high (2) }
- *
- */
- public enum StrengthOfFunction {
- /**
- * Basic function.
- */
- BASIC("basic"),
- /**
- * Medium function.
- */
- MEDIUM("medium"),
- /**
- * Hight function.
- */
- HIGH("high");
-
- @Getter
- private final String value;
-
- /**
- * Basic constructor.
- * @param value string containing the value.
- */
- StrengthOfFunction(final String value) {
- this.value = value;
- }
- }
-
- /**
- * A type to handle the evaluation assurance aevel used in the Common Criteria Measurement.
- * Ordering of enum types is intentional and their ordinal values correspond to enum
- * values in the TCG spec.
- *
- *
- * EvaluationAssuranceLevel ::= ENUMERATED {
- * levell (1),
- * level2 (2),
- * level3 (3),
- * level4 (4),
- * level5 (5),
- * level6 (6),
- * level7 (7) }
- *
- */
- public enum EvaluationAssuranceLevel {
- /**
- * Evaluation Assurance Level 1.
- */
- LEVEL1("level 1"),
- /**
- * Evaluation Assurance Level 2.
- */
- LEVEL2("level 2"),
- /**
- * Evaluation Assurance Level 3.
- */
- LEVEL3("level 3"),
- /**
- * Evaluation Assurance Level 4.
- */
- LEVEL4("level 4"),
- /**
- * Evaluation Assurance Level 5.
- */
- LEVEL5("level 5"),
- /**
- * Evaluation Assurance Level 6.
- */
- LEVEL6("level 6"),
- /**
- * Evaluation Assurance Level 7.
- */
- LEVEL7("level 7");
-
- @Getter
- private final String value;
- /**
- * Basic constructor.
- * @param value string containing the value.
- */
- EvaluationAssuranceLevel(final String value) {
- this.value = value;
- }
- }
-
- private DERIA5String version;
- private EvaluationAssuranceLevel assuranceLevel;
- private EvaluationStatus evaluationStatus;
- private ASN1Boolean plus;
- private StrengthOfFunction strengthOfFunction;
- private ASN1ObjectIdentifier profileOid;
- private URIReference profileUri;
- private ASN1ObjectIdentifier targetOid;
- private URIReference targetUri;
-
- /**
- * Default constructor.
- */
- public CommonCriteriaMeasures() {
- this.version = null;
- this.assuranceLevel = null;
- this.evaluationStatus = null;
- this.plus = ASN1Boolean.FALSE;
- this.strengthOfFunction = null;
- this.profileOid = null;
- this.profileUri = null;
- this.targetOid = null;
- this.targetUri = null;
- }
-
- /**
- * Constructor given the SEQUENCE that contains Common Criteria Measures.
- * @param sequence containing the the common criteria measures
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public CommonCriteriaMeasures(final ASN1Sequence sequence) throws IllegalArgumentException {
-
- //Get all the mandatory values
- int index = 0;
- version = DERIA5String.getInstance(sequence.getObjectAt(index));
- ++index;
- ASN1Enumerated enumarated = ASN1Enumerated.getInstance(sequence.getObjectAt(index));
- ++index;
- //Throw exception when is not between 1 and 7
- if (enumarated.getValue().intValue() <= 0
- || enumarated.getValue().intValue() > EvaluationAssuranceLevel.values().length) {
- throw new IllegalArgumentException("Invalid assurance level.");
- }
- assuranceLevel = EvaluationAssuranceLevel.values()[enumarated.getValue().intValue() - 1];
- enumarated = ASN1Enumerated.getInstance(sequence.getObjectAt(index));
- ++index;
- evaluationStatus = EvaluationStatus.values()[enumarated.getValue().intValue()];
- //Default plus value
- plus = ASN1Boolean.FALSE;
-
- //Current sequence index
- if (sequence.getObjectAt(index).toASN1Primitive() instanceof ASN1Boolean) {
- plus = ASN1Boolean.getInstance(sequence.getObjectAt(index));
- index++;
- }
-
- //Optional values (default to null or empty)
- strengthOfFunction = null;
- profileOid = null;
- profileUri = null;
- targetOid = null;
- targetUri = null;
-
- //Sequence for the URIReference
- ASN1Sequence uriSequence;
-
- //Continue reading the sequence
- for (; index < sequence.size(); index++) {
- ASN1TaggedObject taggedObj = ASN1TaggedObject.getInstance(sequence.getObjectAt(index));
- switch (taggedObj.getTagNo()) {
- case STRENGTH_OF_FUNCTION:
- enumarated = ASN1Enumerated.getInstance(taggedObj, false);
- strengthOfFunction
- = StrengthOfFunction.values()[enumarated.getValue().intValue()];
- break;
- case PROFILE_OID:
- profileOid = ASN1ObjectIdentifier.getInstance(taggedObj, false);
- break;
- case PROFILE_URI:
- uriSequence = ASN1Sequence.getInstance(taggedObj, false);
- profileUri = new URIReference(uriSequence);
- break;
- case TARGET_OID:
- targetOid = ASN1ObjectIdentifier.getInstance(taggedObj, false);
- break;
- case TARGET_URI:
- uriSequence = ASN1Sequence.getInstance(taggedObj, false);
- targetUri = new URIReference(uriSequence);
- break;
- default:
- throw new IllegalArgumentException("Common criteria measures contains "
- + "invalid tagged object.");
- }
- }
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("ComponentIdentifier{");
- sb.append("version=").append(version.toString());
- sb.append(", assuranceLevel=").append(assuranceLevel.getValue());
- sb.append(", evaluationStatus=").append(evaluationStatus.getValue());
- sb.append(", plus=").append(plus.toString());
- //Not null optional objects
- sb.append(", strengthOfFunction=");
- if (strengthOfFunction != null) {
- sb.append(strengthOfFunction.getValue());
- }
- sb.append(", profileOid=");
- if (profileOid != null) {
- sb.append(profileOid.getId());
- }
- sb.append(", profileUri=");
- if (profileUri != null) {
- sb.append(profileUri.toString());
- }
- sb.append(", targetOid=");
- if (targetOid != null) {
- sb.append(targetOid.getId());
- }
- sb.append(", targetUri=");
- if (targetUri != null) {
- sb.append(targetUri.toString());
- }
- sb.append("}");
-
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentAddress.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentAddress.java
deleted file mode 100644
index 5cb07fff..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentAddress.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.Setter;
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERUTF8String;
-
-/**
- * Basic class that handle component addresses from the component identifier.
- *
- * componentAddress ::= SEQUENCE {
- * addressType AddressType,
- * addressValue UTF8String (SIZE (1..STRMAX)) }
- * where STRMAX is 256
- *
- */
-@Getter
-@Setter
-@AllArgsConstructor
-public class ComponentAddress {
-
- /**
- * Number of identifiers that a component address must have.
- */
- public static final int IDENTIFIER_NUMBER = 2;
-
- private static final String ETHERNET_MAC = "2.23.133.17.1";
- private static final String WLAN_MAC = "2.23.133.17.2";
- private static final String BLUETOOTH_MAC = "2.23.133.17.3";
-
- private ASN1ObjectIdentifier addressType;
- private DERUTF8String addressValue;
-
- /**
- * Default constructor.
- */
- public ComponentAddress() {
- addressType = null;
- addressValue = null;
- }
-
- /**
- * Constructor given the SEQUENCE that contains the type and value for the
- * component address.
- *
- * @param sequence containing the type and value for the component address
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public ComponentAddress(final ASN1Sequence sequence) throws IllegalArgumentException {
- //Check if the sequence contains the two values required
- if (sequence.size() != IDENTIFIER_NUMBER) {
- throw new IllegalArgumentException("Component address does not contain "
- + "all the required fields.");
- }
- addressType = ASN1ObjectIdentifier.getInstance(sequence.getObjectAt(0));
- addressValue = DERUTF8String.getInstance(sequence.getObjectAt(1));
- }
-
- /**
- * Get the string value for the address type.
- * @return the string value for the address type
- */
- public String getAddressTypeValue() {
- String typeValue;
- switch (this.addressType.getId()) {
- case ETHERNET_MAC:
- typeValue = "ethernet mac";
- break;
- case WLAN_MAC:
- typeValue = "wlan mac";
- break;
- case BLUETOOTH_MAC:
- typeValue = "bluetooth mac";
- break;
- default:
- typeValue = "unknown mac";
- break;
- }
- return typeValue;
- }
-
- @Override
- public String toString() {
- return "ComponentAddress{"
- + "addressType=" + addressType.getId()
- + ", addressValue=" + addressValue.getString()
- + '}';
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentClass.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentClass.java
deleted file mode 100644
index ae8aa7ec..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentClass.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import com.eclipsesource.json.JsonObject;
-import com.eclipsesource.json.JsonObject.Member;
-import hirs.attestationca.utils.JsonUtils;
-import lombok.Getter;
-
-import java.nio.file.FileSystems;
-import java.nio.file.Path;
-
-/**
- *
- * componentClass ::= SEQUENCE {
- * componentClassRegistry ComponentClassRegistry,
- * componentClassValue OCTET STRING SIZE(4) ) }
- *
- *
- * A note for the future.
- */
-public class ComponentClass {
- private static final String TCG_COMPONENT_REGISTRY = "2.23.133.18.3.1";
- private static final String SMBIOS_COMPONENT_REGISTRY = "2.23.133.18.3.3";
- private static final Path JSON_PATH = FileSystems.getDefault()
- .getPath("/opt", "hirs", "default-properties", "component-class.json");
-
-// private static final Path JSON_PATH = FileSystems.getDefault()
-// .getPath("/opt", "hirs", "default-properties", "component-class.json");
- private static final String OTHER_STRING = "Other";
- private static final String UNKNOWN_STRING = "Unknown";
- private static final String NONE_STRING = "None";
-
- // Used to indicate that the component string value provided is erroneous
- private static final String ERROR = "-1";
- private static final int MID_INDEX = 4;
- /**
- * All TCG categories have Other and Unknown as the first 2 values.
- */
- private static final String OTHER = "0000";
- private static final String UNKNOWN = "0001";
-
- @Getter
- private String category, categoryStr;
- @Getter
- private String component, componentStr;
- private String registryType;
- private String componentIdentifier;
-
- /**
- * Default class constructor.
- */
- public ComponentClass() {
- this("TCG", JSON_PATH, UNKNOWN);
- }
-
- /**
- * Class Constructor that takes a String representation of the component
- * value.
- *
- * @param registryOid the decimal notation for the type of registry
- * @param componentIdentifier component value
- */
- public ComponentClass(final String registryOid, final String componentIdentifier) {
- this(registryOid, JSON_PATH, componentIdentifier);
- }
-
- /**
- * Class Constructor that takes a String representation of the component
- * value.
- *
- * @param componentClassPath file path for the json
- * @param componentIdentifier component value
- */
- public ComponentClass(final Path componentClassPath, final String componentIdentifier) {
- this(TCG_COMPONENT_REGISTRY, componentClassPath, componentIdentifier);
- }
-
- /**
- * Main Class Constructor that takes in an integer representation of the
- * component value. Sets main class variables to default values and then
- * matches the value against defined values in the associated JSON file.
- *
- * @param registryOid the decimal notation for the type of registry
- * @param componentClassPath file path for the json
- * @param componentIdentifier component value
- */
- public ComponentClass(final String registryOid,
- final Path componentClassPath,
- final String componentIdentifier) {
- this.category = OTHER;
- this.component = NONE_STRING;
- if (componentIdentifier == null || componentIdentifier.isEmpty()) {
- this.componentIdentifier = "";
- } else {
- this.componentIdentifier = verifyComponentValue(componentIdentifier);
- }
-
- switch (registryOid) {
- case TCG_COMPONENT_REGISTRY -> registryType = "TCG";
- case SMBIOS_COMPONENT_REGISTRY -> registryType = "SMBIOS";
- default -> registryType = UNKNOWN_STRING;
- }
-
- switch (this.componentIdentifier) {
- case OTHER:
- this.categoryStr = NONE_STRING;
- this.component = OTHER;
- this.componentStr = OTHER_STRING;
- break;
- case UNKNOWN:
- case "":
- this.categoryStr = NONE_STRING;
- this.component = UNKNOWN;
- this.componentStr = UNKNOWN_STRING;
- break;
- case ERROR:
- // Number Format Exception
- break;
- default:
- this.category = this.componentIdentifier.substring(0, MID_INDEX) + this.category;
- this.component = OTHER + this.componentIdentifier.substring(MID_INDEX);
- findStringValues(JsonUtils.getSpecificJsonObject(componentClassPath, registryType));
- break;
- }
- }
-
- /**
- * This is the main way this class will be referenced and how it
- * will be displayed on the portal.
- * @return String combination of category and component.
- */
- @Override
- public String toString() {
- String resultString;
- if (componentStr.equals(UNKNOWN_STRING) || component.equals(OTHER_STRING)) {
- resultString = String.format("%s%n%s", registryType, categoryStr);
- } else {
- resultString = String.format("%s%n%s - %s", registryType, categoryStr, componentStr);
- }
- return resultString;
- }
-
- /**
- * Getter for the Category mapped to the associated value in.
- *
- * @param categories a JSON object associated with mapped categories in file
- * {}@link componentIdentifier}.
- */
- private void findStringValues(final JsonObject categories) {
- String categoryID;
- String componentMask;
- boolean found = false;
-
- if (categories != null) {
- for (String name : categories.names()) {
- categoryID = verifyComponentValue(categories.get(name)
- .asObject().get("ID").asString());
- componentMask = componentIdentifier.substring(MID_INDEX);
- // check for the correct flag
- if (categoryMatch(componentIdentifier.substring(0, MID_INDEX),
- categoryID.substring(0, MID_INDEX))) {
- found = true;
- JsonObject componentTypes = categories.get(name)
- .asObject().get("Types").asObject();
- categoryStr = name;
-
- switch (componentMask) {
- case OTHER -> componentStr = OTHER_STRING;
- case UNKNOWN -> componentStr = UNKNOWN_STRING;
- default -> getComponent(componentTypes);
- }
- }
- }
- }
-
- if (!found) {
- this.categoryStr = NONE_STRING;
- this.componentStr = UNKNOWN_STRING;
- }
- }
-
- /**
- * Returns the value of the comparison between a category and the what's in the id.
- * @param category the category to compare
- * @param componentId the id value to compare
- * @return true if they match
- */
- public boolean categoryMatch(final String category, final String componentId) {
- return category.equals(componentId);
- }
-
- /**
- * Getter for the component associated with the component JSON Object mapped
- * in the JSON file.
- *
- * @param components JSON Object for the categories components
- */
- private void getComponent(final JsonObject components) {
- String typeID;
-
- if (components != null) {
- for (Member member : components) {
- typeID = verifyComponentValue(member.getName());
-
- if (component.equals(typeID)) {
- componentStr = member.getValue().asString();
- }
- }
- }
- }
-
- /**
- * This method converts the string representation of the component ID into
- * an integer. Or throws and error if the format is in error.
- *
- * @param component string representation of the component ID
- * @return the int representation of the component
- */
- private static String verifyComponentValue(final String component) {
- String componentValue = ERROR;
-
- if (component != null) {
- try {
- if (component.contains("x")) {
- componentValue = component.substring(component.indexOf("x") + 1);
- } else {
- if (component.contains("#")) {
- componentValue = component.replace("#", "");
- } else {
- return component;
- }
- }
- } catch (NumberFormatException nfEx) {
- //invalid entry
- }
- }
-
- return componentValue;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentIdentifier.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentIdentifier.java
deleted file mode 100644
index 976bd0cf..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/ComponentIdentifier.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.commons.lang3.StringUtils;
-import org.bouncycastle.asn1.ASN1Boolean;
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERUTF8String;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Basic class that handle component identifiers from the Platform Configuration
- * Attribute.
- *
- * ComponentIdentifier ::= SEQUENCE {
- * componentManufacturer UTF8String (SIZE (1..STRMAX)),
- * componentModel UTF8String (SIZE (1..STRMAX)),
- * componentSerial[0] IMPLICIT UTF8String (SIZE (1..STRMAX)) OPTIONAL,
- * componentRevision [1] IMPLICIT UTF8String (SIZE (1..STRMAX)) OPTIONAL,
- * componentManufacturerId [2] IMPLICIT PrivateEnterpriseNumber OPTIONAL,
- * fieldReplaceable [3] IMPLICIT BOOLEAN OPTIONAL,
- * componentAddress [4] IMPLICIT
- * SEQUENCE(SIZE(1..CONFIGMAX)) OF ComponentAddress OPTIONAL}
- * where STRMAX is 256, CONFIGMAX is 32
- *
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@EqualsAndHashCode
-public class ComponentIdentifier {
-
- /**
- * Variable for components that aren't set.
- */
- public static final String EMPTY_COMPONENT = "[Empty]";
- /**
- * Variable for components that aren't set.
- */
- public static final String NOT_SPECIFIED_COMPONENT = "Not Specified";
- /**
- * Maximum number of configurations.
- */
- public static final int CONFIGMAX = 32;
-
- private static final int MANDATORY_ELEMENTS = 2;
- // optional sequence objects
- /**
- * Static variable indicated array position for the serial number.
- */
- protected static final int COMPONENT_SERIAL = 0;
- /**
- * Static variable indicated array position for the revision info.
- */
- protected static final int COMPONENT_REVISION = 1;
- /**
- * Static variable indicated array position for the manufacturer id.
- */
- protected static final int COMPONENT_MANUFACTURER_ID = 2;
- /**
- * Static variable indicated array position for the field replaceable value.
- */
- protected static final int FIELD_REPLACEABLE = 3;
- /**
- * Static variable indicated array position for the component address.
- */
- protected static final int COMPONENT_ADDRESS = 4;
-
- private DERUTF8String componentManufacturer;
- private DERUTF8String componentModel;
- private DERUTF8String componentSerial;
- private DERUTF8String componentRevision;
- private ASN1ObjectIdentifier componentManufacturerId;
- private ASN1Boolean fieldReplaceable;
- private List
- * FIPSLevel ::= SEQUENCE {
- * version IA5STRING (SIZE (1..STRMAX)), -- "140-1" or "140-2"
- * level SecurityLevel,
- * plus BOOLEAN DEFAULT FALSE }
- *
- */
-@AllArgsConstructor
-public class FIPSLevel {
-
- private static final int MAX_SEQUENCE_SIZE = 3;
- /**
- * A type to handle the security Level used in the FIPS Level.
- * Ordering of enum types is intentional and their ordinal values correspond to enum
- * values in the TCG spec.
- *
- *
- * SecurityLevel ::= ENUMERATED {
- * level1 (1),
- * level2 (2),
- * level3 (3),
- * level4 (4) }
- *
- */
- public enum SecurityLevel {
- /**
- * Security Level 1.
- */
- LEVEL1("level 1"),
- /**
- * Security Level 2.
- */
- LEVEL2("level 2"),
- /**
- * Security Level 3.
- */
- LEVEL3("level 3"),
- /**
- * Security Level 4.
- */
- LEVEL4("level 4");
-
- private final String value;
- /**
- * Basic constructor.
- * @param value string containing the value.
- */
- SecurityLevel(final String value) {
- this.value = value;
- }
-
- /**
- * Get the string value from the StrengthOfFunction.
- * @return the string containing the value.
- */
- public String getValue() {
- return this.value;
- }
- }
-
- @Getter @Setter
- private DERIA5String version;
- @Getter @Setter
- private SecurityLevel level;
- @Getter @Setter
- private ASN1Boolean plus;
-
- /**
- * Default constructor.
- */
- public FIPSLevel() {
- version = null;
- level = null;
- plus = null;
- }
-
- /**
- * Constructor given the SEQUENCE that contains the FIPLevel Object.
- *
- * @param sequence containing the FIPS Level Object
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public FIPSLevel(final ASN1Sequence sequence) throws IllegalArgumentException {
- //Get version
- version = DERIA5String.getInstance(sequence.getObjectAt(0));
- //Get and validate level
- ASN1Enumerated enumarated = ASN1Enumerated.getInstance(sequence.getObjectAt(1));
- //Throw exception when is not between 1 and 7
- if (enumarated.getValue().intValue() <= 0
- || enumarated.getValue().intValue() > SecurityLevel.values().length) {
- throw new IllegalArgumentException("Invalid security level on FIPSLevel.");
- }
- level = SecurityLevel.values()[enumarated.getValue().intValue() - 1];
-
- //Check if there is another value on the sequence for the plus
- plus = ASN1Boolean.FALSE; //Default to false
- if (sequence.size() == MAX_SEQUENCE_SIZE) {
- plus = ASN1Boolean.getInstance(sequence.getObjectAt(2));
- }
- }
-
- @Override
- public String toString() {
- return "FIPSLevel{"
- + "version=" + version.getString()
- + ", level=" + level.getValue()
- + ", plus=" + plus.toString()
- + '}';
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformConfiguration.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformConfiguration.java
deleted file mode 100644
index 93f17cc0..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformConfiguration.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Abstract class that provides base info for Platform Configuration of
- * the Platform Certificate Attribute.
- */
-@AllArgsConstructor
-public abstract class PlatformConfiguration {
- private List
- * PlatformConfiguration ::= SEQUENCE {
- * componentIdentifier [0] IMPLICIT SEQUENCE(SIZE(1..CONFIGMAX)) OF
- * ComponentIdentifier OPTIONAL,
- * platformProperties [1] IMPLICIT SEQUENCE(SIZE(1..CONFIGMAX)) OF Properties OPTIONAL,
- * platformPropertiesUri [2] IMPLICIT URIReference OPTIONAL }
- *
- */
-public class PlatformConfigurationV1 extends PlatformConfiguration {
-
- private static final int COMPONENT_IDENTIFIER = 0;
- private static final int PLATFORM_PROPERTIES = 1;
- private static final int PLATFORM_PROPERTIES_URI = 2;
-
- /**
- * Constructor given the SEQUENCE that contains Platform Configuration.
- * @param sequence containing the the Platform Configuration.
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public PlatformConfigurationV1(final ASN1Sequence sequence) throws IllegalArgumentException {
-
- //Default values
- setComponentIdentifier(new ArrayList<>());
- setPlatformProperties(new ArrayList<>());
- setPlatformPropertiesUri(null);
-
- for (int i = 0; i < sequence.size(); i++) {
- ASN1TaggedObject taggedSequence
- = ASN1TaggedObject.getInstance(sequence.getObjectAt(i));
- //Set information based on the set tagged
- switch (taggedSequence.getTagNo()) {
- case COMPONENT_IDENTIFIER:
- //Get componentIdentifier
- ASN1Sequence componentConfiguration
- = ASN1Sequence.getInstance(taggedSequence, false);
-
- //Get and set all the component values
- for (int j = 0; j < componentConfiguration.size(); j++) {
- //DERSequence with the components
- ASN1Sequence component
- = ASN1Sequence.getInstance(componentConfiguration.getObjectAt(j));
- add(new ComponentIdentifier(component));
- }
- break;
- case PLATFORM_PROPERTIES:
- //Get platformProperties
- ASN1Sequence properties = ASN1Sequence.getInstance(taggedSequence, false);
-
- //Get and set all the properties values
- for (int j = 0; j < properties.size(); j++) {
- //DERSequence with the components
- ASN1Sequence property = ASN1Sequence.getInstance(properties.getObjectAt(j));
- add(new PlatformProperty(property));
- }
- break;
- case PLATFORM_PROPERTIES_URI:
- //Get platformPropertiesURI
- ASN1Sequence propertiesUri = ASN1Sequence.getInstance(taggedSequence, false);
- //Save properties URI
- setPlatformPropertiesUri(new URIReference(propertiesUri));
- break;
- default:
- break;
- }
- }
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("PlatformConfiguration{");
- sb.append("componentIdentifier=");
- if (getComponentIdentifier().size() > 0) {
- sb.append(getComponentIdentifier()
- .stream()
- .map(Object::toString)
- .collect(Collectors.joining(",")));
- }
- sb.append(", platformProperties=");
- if (getPlatformProperties().size() > 0) {
- sb.append(getPlatformProperties()
- .stream()
- .map(Object::toString)
- .collect(Collectors.joining(",")));
- }
- sb.append(", platformPropertiesUri=");
- if (getPlatformPropertiesUri() != null) {
- sb.append(getPlatformPropertiesUri().toString());
- }
- sb.append("}");
-
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformProperty.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformProperty.java
deleted file mode 100644
index c70fe53c..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/PlatformProperty.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.Setter;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERUTF8String;
-
-/**
- *
- * Basic class that handles a single property for the platform configuration.
- *
- * Properties ::= SEQUENCE {
- * propertyName UTF8String (SIZE (1..STRMAX)),
- * propertyValue UTF8String (SIZE (1..STRMAX) }
- *
- *
- */
-@Getter
-@Setter
-@AllArgsConstructor
-public class PlatformProperty {
-
- private static final String NOT_SPECIFIED = "Not Specified";
-
- /**
- * Number of identifiers for version 1.
- */
- protected static final int IDENTIFIER_NUMBER = 2;
-
- private DERUTF8String propertyName;
- private DERUTF8String propertyValue;
-
- /**
- * Default constructor.
- */
- public PlatformProperty() {
- this.propertyName = new DERUTF8String(NOT_SPECIFIED);
- this.propertyValue = new DERUTF8String(NOT_SPECIFIED);
- }
-
- /**
- * Constructor given the SEQUENCE that contains the name and value for the
- * platform property.
- *
- * @param sequence containing the name and value of the platform property
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public PlatformProperty(final ASN1Sequence sequence) throws IllegalArgumentException {
- // Check if the sequence contains the two values required
- if (sequence.size() != IDENTIFIER_NUMBER) {
- throw new IllegalArgumentException("Platform properties does not contain all "
- + "the required fields.");
- }
-
- this.propertyName = DERUTF8String.getInstance(sequence.getObjectAt(0));
- this.propertyValue = DERUTF8String.getInstance(sequence.getObjectAt(1));
- }
-
- @Override
- public String toString() {
- return "PlatformProperty{"
- + "propertyName=" + propertyName.getString()
- + ", propertyValue=" + propertyValue.getString()
- + "}";
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TBBSecurityAssertion.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TBBSecurityAssertion.java
deleted file mode 100644
index 689136e6..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TBBSecurityAssertion.java
+++ /dev/null
@@ -1,282 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.bouncycastle.asn1.ASN1Boolean;
-import org.bouncycastle.asn1.ASN1Enumerated;
-import org.bouncycastle.asn1.ASN1Integer;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERIA5String;
-
-import java.math.BigInteger;
-
-/**
- * Basic class that handle component identifiers from the Platform Configuration
- * Attribute.
- *
- * TBBSecurityAssertions ::= SEQUENCE {
- * version Version DEFAULT v1,
- * ccInfo [0] IMPLICIT CommonCriteriaMeasures OPTIONAL,
- * fipsLevel [1] IMPLICIT FIPSLevel OPTIONAL,
- * rtmType [2] IMPLICIT MeasurementRootType OPTIONAL,
- * iso9000Certified BOOLEAN DEFAULT FALSE,
- * iso9000Uri IA5STRING (SIZE (1..URIMAX)) OPTIONAL }
- *
- */
-@AllArgsConstructor
-public class TBBSecurityAssertion {
-
- private static final int CCINFO = 0;
- private static final int FIPSLEVEL = 1;
- private static final int RTMTYPE = 2;
-
- /**
- * A type to handle the evaluation status used in the Common Criteria Measurement.
- * Ordering of enum types is intentional and their ordinal values correspond to enum
- * values in the TCG spec.
- *
- *
- * MeasurementRootType ::= ENUMERATED {
- * static (0),
- * dynamic (1),
- * nonHost (2),
- * hybrid (3),
- * physical (4),
- * virtual (5) }
- *
- */
- public enum MeasurementRootType {
- /**
- * Static measurement root type.
- */
- STATIC("static"),
- /**
- * Dynamic measurement root type.
- */
- DYNAMIC("dynamic"),
- /**
- * Non-Host measurement root type.
- */
- NONHOST("nonHost"),
- /**
- * Hybrid measurement root type.
- */
- HYBRID("hybrid"),
- /**
- * Physical measurement root type.
- */
- PHYSICAL("physical"),
- /**
- * Virtual measurement root type.
- */
- VIRTUAL("virtual");
-
- @Getter
- private final String value;
-
- /**
- * Basic constructor.
- * @param value string containing the value.
- */
- MeasurementRootType(final String value) {
- this.value = value;
- }
- }
-
- private ASN1Integer version;
- private CommonCriteriaMeasures ccInfo;
- private FIPSLevel fipsLevel;
- private MeasurementRootType rtmType;
- private ASN1Boolean iso9000Certified;
- private DERIA5String iso9000Uri;
-
- /**
- * Default constructor.
- */
- public TBBSecurityAssertion() {
- version = null;
- ccInfo = null;
- fipsLevel = null;
- rtmType = null;
- iso9000Certified = null;
- iso9000Uri = null;
- }
-
- /**
- * Constructor given the SEQUENCE that contains a TBBSecurityAssertion Object.
- * @param sequence containing the the TBB Security Assertion
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public TBBSecurityAssertion(final ASN1Sequence sequence) throws IllegalArgumentException {
- int index = 0;
- //sequence size
- int sequenceSize = sequence.size();
-
- //Default values
- version = new ASN1Integer(BigInteger.valueOf(0)); //Default v1 (0)
- ccInfo = null;
- fipsLevel = null;
- rtmType = null;
- iso9000Certified = ASN1Boolean.FALSE;
- iso9000Uri = null;
-
- // Only contains defaults
- if (sequence.size() == 0) {
- return;
- }
-
- // Get version if present
- if (sequence.getObjectAt(index).toASN1Primitive() instanceof ASN1Integer) {
- version = ASN1Integer.getInstance(sequence.getObjectAt(index));
- index++;
- }
-
- // Check if it's a tag value
- while (index < sequenceSize
- && sequence.getObjectAt(index).toASN1Primitive() instanceof ASN1TaggedObject) {
- ASN1TaggedObject taggedObj = ASN1TaggedObject.getInstance(sequence.getObjectAt(index));
- switch (taggedObj.getTagNo()) {
- case CCINFO:
- ASN1Sequence cciSequence = ASN1Sequence.getInstance(taggedObj, false);
- ccInfo = new CommonCriteriaMeasures(cciSequence);
- break;
- case FIPSLEVEL:
- ASN1Sequence fipsSequence = ASN1Sequence.getInstance(taggedObj, false);
- fipsLevel = new FIPSLevel(fipsSequence);
- break;
- case RTMTYPE:
- ASN1Enumerated enumerated = ASN1Enumerated.getInstance(taggedObj, false);
- rtmType = MeasurementRootType.values()[enumerated.getValue().intValue()];
- break;
- default:
- throw new IllegalArgumentException("TBB Security Assertion contains "
- + "invalid tagged object.");
- }
- index++;
- }
- // Check if it's a boolean
- if (index < sequenceSize
- && sequence.getObjectAt(index).toASN1Primitive() instanceof ASN1Boolean) {
- iso9000Certified = ASN1Boolean.getInstance(sequence.getObjectAt(index));
- index++;
- }
- // Check if it's a IA5String
- if (index < sequenceSize
- && sequence.getObjectAt(index).toASN1Primitive() instanceof DERIA5String) {
- iso9000Uri = DERIA5String.getInstance(sequence.getObjectAt(index));
- }
- }
-
- /**
- * @return the version
- */
- public ASN1Integer getVersion() {
- return version;
- }
-
- /**
- * @param version the version to set
- */
- public void setVersion(final ASN1Integer version) {
- this.version = version;
- }
-
- /**
- * @return the ccInfo
- */
- public CommonCriteriaMeasures getCcInfo() {
- return ccInfo;
- }
-
- /**
- * @param ccInfo the ccInfo to set
- */
- public void setCcInfo(final CommonCriteriaMeasures ccInfo) {
- this.ccInfo = ccInfo;
- }
-
- /**
- * @return the fipsLevel
- */
- public FIPSLevel getFipsLevel() {
- return fipsLevel;
- }
-
- /**
- * @param fipsLevel the fipsLevel to set
- */
- public void setFipsLevel(final FIPSLevel fipsLevel) {
- this.fipsLevel = fipsLevel;
- }
-
- /**
- * @return the rtmType
- */
- public MeasurementRootType getRtmType() {
- return rtmType;
- }
-
- /**
- * @param rtmType the rtmType to set
- */
- public void setRtmType(final MeasurementRootType rtmType) {
- this.rtmType = rtmType;
- }
-
- /**
- * @return the iso9000Certified
- */
- public ASN1Boolean getIso9000Certified() {
- return iso9000Certified;
- }
-
- /**
- * @param iso9000Certified the iso9000Certified to set
- */
- public void setIso9000Certified(final ASN1Boolean iso9000Certified) {
- this.iso9000Certified = iso9000Certified;
- }
-
- /**
- * @return the iso9000Uri
- */
- public DERIA5String getIso9000Uri() {
- return iso9000Uri;
- }
-
- /**
- * @param iso9000Uri the iso9000Uri to set
- */
- public void setIso9000Uri(final DERIA5String iso9000Uri) {
- this.iso9000Uri = iso9000Uri;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("TBBSecurityAssertion{");
- sb.append("version=").append(version.toString());
- //Optional values not null
- sb.append(", ccInfo=");
- if (ccInfo != null) {
- sb.append(ccInfo.toString());
- }
- sb.append(", fipsLevel=");
- if (fipsLevel != null) {
- sb.append(fipsLevel.toString());
- }
- sb.append(", rtmType=");
- if (rtmType != null) {
- sb.append(rtmType.getValue());
- }
- sb.append(", iso9000Certified=").append(iso9000Certified.toString());
- sb.append(", iso9000Uri=");
- if (iso9000Uri != null) {
- sb.append(iso9000Uri.getString());
- }
- sb.append("}");
-
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSecurityAssertions.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSecurityAssertions.java
deleted file mode 100644
index 1650e7c6..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSecurityAssertions.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import lombok.AccessLevel;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.math.BigInteger;
-
-/**
- * A class to represent the TPM Security Assertions in an Endorsement Credential as
- * defined by the TCG spec for TPM 1.2.
- *
- * https://www.trustedcomputinggroup.org/wp-content/uploads/IWG-Credential_Profiles_V1_R0.pdf
- *
- * Future iterations of this code may want to reference
- * www.trustedcomputinggroup.org/wp-content/uploads/Credential_Profile_EK_V2.0_R14_published.pdf
- * for specifications for TPM 2.0 (pg. 19).
- */
-@AllArgsConstructor
-@NoArgsConstructor(access = AccessLevel.PROTECTED)
-@Getter @Setter
-@Embeddable
-public class TPMSecurityAssertions {
-
- /**
- * A type to handle the different endorsement key generation types used in the TPM
- * Assertions field of an endorsement credential. Ordering of enum types is intentional
- * and their ordinal values correspond to enum values in the TCG spec.
- */
-
- public enum EkGenerationType {
- /**
- * Generated internally within the TPM and cannot be revoked. Enum value of 0.
- */
- INTERNAL,
- /**
- * Generated externally and then inserted under a controlled environment during
- * manufacturing. Cannot be revoked. Enum value of 1.
- */
- INJECTED,
- /**
- * Generated internally within the TPM and can be revoked. Enum value of 2.
- */
- INTERNAL_REVOCABLE,
- /**
- * Generated externally and then inserted under a controlled environment during
- * manufacturing. Can be revoked. Enum value of 3.
- */
- INJECTED_REVOCABLE;
- }
-
- /**
- * A type to handle the different endorsement key generation locations used in
- * specifying the endorsement key generation location and the endorsement key
- * certificate generation location in the TPM Assertions field of an endorsement
- * credential. Ordering of enum types is intentional and their ordinal values
- * correspond to enum values in the TCG spec.
- */
- public enum EkGenerationLocation {
- /**
- * Generated by the TPM Manufacturer. Enum value of 0.
- */
- TPM_MANUFACTURER,
- /**
- * Generated by the Platform Manufacturer. Enum value of 1.
- */
- PLATFORM_MANUFACTURER,
- /**
- * Generated by the endorsement key certificate signer. Enum value of 2.
- */
- EK_CERT_SIGNER;
- }
-
- @Column
- private BigInteger tpmSecAssertsVersion; //default v1
-
- @Column
- private boolean fieldUpgradeable; //default false
-
- @Column(nullable = true)
- private EkGenerationType ekGenType; //optional
-
- @Column(nullable = true)
- private EkGenerationLocation ekGenerationLocation; //optional
-
- @Column(nullable = true)
- private EkGenerationLocation ekCertificateGenerationLocation; //optional
-
- // Future work (may need to create other classes):
- //private CommonCriteriaMeasures commCritMeasures; //optional
- //private FIPSLevel fipsLevel; //optional
- //private boolean iso9000Certified; //default false
- //private IA5String iso9000Uri; //optional
-
- /**
- * Standard constructor that sets required fields. Use accessor methods
- * to set optional fields.
- * @param version the version of the security assertions
- * @param fieldUpgradeable whether or not the security assertions are
- * field upgradeable.
- */
- public TPMSecurityAssertions(final BigInteger version, final boolean fieldUpgradeable) {
- this.tpmSecAssertsVersion = version;
- this.fieldUpgradeable = fieldUpgradeable;
- }
-
- @Override
- public String toString() {
- return "TPMSecurityAssertions{"
- + "version=" + tpmSecAssertsVersion
- + ", fieldUpgradeable=" + fieldUpgradeable
- + ", ekGenType=" + ekGenType
- + ", ekGenLoc=" + ekGenerationLocation
- + ", ekCertGenLoc=" + ekCertificateGenerationLocation
- + '}';
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSpecification.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSpecification.java
deleted file mode 100644
index 9d7848e2..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/TPMSpecification.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import lombok.AccessLevel;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-
-import java.math.BigInteger;
-
-/**
- * A class to represent the TPM Specification in an Endorsement Credential as
- * defined by the TCG spec for TPM 1.2.
- *
- * https://www.trustedcomputinggroup.org/wp-content/uploads/IWG-Credential_Profiles_V1_R0.pdf
- *
- * Future iterations of this code may want to reference
- * www.trustedcomputinggroup.org/wp-content/uploads/Credential_Profile_EK_V2.0_R14_published.pdf
- * for specifications for TPM 2.0.
- */
-@EqualsAndHashCode
-@NoArgsConstructor(access= AccessLevel.PROTECTED)
-@Getter
-@Embeddable
-public class TPMSpecification {
-
- @Column
- private String family;
-
- @Column
- private BigInteger level;
-
- @Column
- private BigInteger revision;
-
- /**
- * Standard constructor.
- * @param family the specification family.
- * @param level the specification level.
- * @param revision the specification revision.
- */
- public TPMSpecification(final String family, final BigInteger level,
- final BigInteger revision) {
- this.family = family;
- this.level = level;
- this.revision = revision;
- }
-
- @Override
- public String toString() {
- return "TPMSpecification{"
- + "family='" + family + '\''
- + ", level=" + level
- + ", revision=" + revision
- + '}';
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/URIReference.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/URIReference.java
deleted file mode 100644
index df680ff0..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/URIReference.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.Setter;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERIA5String;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-/**
- *
- * Basic class that handle a URIReference object.
- *
- * URIReference ::= SEQUENCE {
- * uniformResourceIdentifier IA5String (SIZE (1..URIMAX)),
- * hashAlgorithm AlgorithmIdentifier OPTIONAL,
- * hashValue BIT STRING OPTIONAL
- }
- *
- */
-@Getter @Setter
-@AllArgsConstructor
-public class URIReference {
- private DERIA5String uniformResourceIdentifier;
- private AlgorithmIdentifier hashAlgorithm;
- @JsonIgnore
- private DERBitString hashValue;
-
- private static final int PLATFORM_PROPERTIES_URI_MAX = 3;
- private static final int PLATFORM_PROPERTIES_URI_MIN = 1;
-
- /**
- * Default constructor.
- */
- public URIReference() {
- this.uniformResourceIdentifier = null;
- this.hashAlgorithm = null;
- this.hashValue = null;
- }
-
- /**
- * Constructor given the SEQUENCE that contains the URIReference values.
- *
- * @param sequence containing the name and value of the platform property
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public URIReference(final ASN1Sequence sequence) throws IllegalArgumentException {
- //Check if the sequence contains the two values required
- if (sequence.size() > PLATFORM_PROPERTIES_URI_MAX
- || sequence.size() < PLATFORM_PROPERTIES_URI_MIN) {
- throw new IllegalArgumentException("PlatformPropertiesURI contains invalid "
- + "number of fields.");
- }
-
- //Get the Platform Configuration URI values
- for (int j = 0; j < sequence.size(); j++) {
- if (sequence.getObjectAt(j) instanceof DERIA5String) {
- this.uniformResourceIdentifier = DERIA5String.getInstance(sequence.getObjectAt(j));
- } else if ((sequence.getObjectAt(j) instanceof AlgorithmIdentifier)
- || (sequence.getObjectAt(j) instanceof ASN1Sequence)) {
- this.hashAlgorithm =
- AlgorithmIdentifier.getInstance(sequence.getObjectAt(j));
- } else if (sequence.getObjectAt(j) instanceof DERBitString) {
- this.hashValue = DERBitString.getInstance(sequence.getObjectAt(j));
- } else {
- throw new IllegalArgumentException("Unexpected DER type found. "
- + sequence.getObjectAt(j).getClass().getName() + " found at index " + j + ".");
- }
- }
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("URIReference{");
- sb.append("uniformResourceIdentifier=").append(uniformResourceIdentifier.getString());
- //Check of optional values are not null
- sb.append(", hashAlgorithm=");
- if (hashAlgorithm != null) {
- sb.append(hashAlgorithm.getAlgorithm().getId());
- }
- sb.append(", hashValue=");
- if (hashValue != null) {
- sb.append(hashValue.getString());
- }
- sb.append("}");
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/AttributeStatus.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/AttributeStatus.java
deleted file mode 100644
index 7341071a..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/AttributeStatus.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes.V2;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * A type to handle the security Level used in the FIPS Level.
- * Ordering of enum types is intentional and their ordinal values correspond to enum
- * values in the TCG spec.
- *
- *
- * AttributeStatus ::= ENUMERATED {
- * added (0),
- * modified (1),
- * removed (2) }
- *
- */
-@AllArgsConstructor
-public enum AttributeStatus {
- /**
- * Attribute Status for ADDED.
- */
- ADDED("added"),
- /**
- * Attribute Status for MODIFIED.
- */
- MODIFIED("modified"),
- /**
- * Attribute Status for REMOVED.
- */
- REMOVED("removed"),
- /**
- * Attribute Status for EMPTY.
- */
- EMPTY_STATUS(StringUtils.EMPTY);
-
- @Getter
- private final String value;
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/CertificateIdentifier.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/CertificateIdentifier.java
deleted file mode 100644
index b9fff721..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/CertificateIdentifier.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes.V2;
-
-import lombok.Getter;
-import org.bouncycastle.asn1.ASN1Integer;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.GeneralName;
-
-import java.math.BigInteger;
-
-/**
- * Basic class that handles a the attribute associate with a Certificate
- * Identifier for the component.
- *
- * CertificateIdentifier::= SEQUENCE {
- * attributeCertIdentifier [0] IMPLICIT AttributeCertificateIdentifier OPTIONAL
- * genericCertIdentifier [1] IMPLICIT IssuerSerial OPTIONAL }
- *
- * AttributeCertificateIdentifier ::= SEQUENCE {
- * hashAlgorithm AlgorithmIdentifier,
- * hashOverSignatureValue OCTET STRING }
- *
- * IssuerSerial ::= SEQUENCE {
- * issuer GeneralNames,
- * serial CertificateSerialNumber }
- *
- */
-@Getter
-public class CertificateIdentifier {
- private static final String NOT_SPECIFIED = "Not Specified";
-
- private static final int SEQUENCE_NUMBER = 2;
- private static final int ATTRIBUTE_ID_INDEX = 0;
- private static final int GENERIC_ID_INDEX = 1;
-
- private String hashAlgorithm;
- private String hashSigValue;
- private GeneralName issuerDN;
- private BigInteger certificateSerialNumber;
-
- /**
- * Default constructor.
- */
- public CertificateIdentifier() {
- hashAlgorithm = NOT_SPECIFIED;
- hashSigValue = null;
- issuerDN = null;
- certificateSerialNumber = BigInteger.ZERO;
- }
-
- /**
- * Primary constructor for the parsing of the sequence.
- * @param sequence containing the name and value of the Certificate Identifier
- */
- public CertificateIdentifier(final ASN1Sequence sequence) {
- this();
-
- ASN1TaggedObject taggedObj;
- for (int i = 0; i < sequence.size(); i++) {
- taggedObj = ASN1TaggedObject.getInstance(sequence.getObjectAt(i));
-
- switch (taggedObj.getTagNo()) {
- case ATTRIBUTE_ID_INDEX:
- // attributecertificateidentifier
- parseAttributeCertId(ASN1Sequence.getInstance(taggedObj, false));
- break;
- case GENERIC_ID_INDEX:
- // issuerserial
- parseGenericCertId(ASN1Sequence.getInstance(taggedObj, false));
- break;
- default:
- break;
- }
- }
- }
-
- private void parseAttributeCertId(final ASN1Sequence attrCertSeq) {
- //Check if it have a valid number of identifiers
- if (attrCertSeq.size() != SEQUENCE_NUMBER) {
- throw new IllegalArgumentException("CertificateIdentifier"
- + ".AttributeCertificateIdentifier does not have required values.");
- }
-
- hashAlgorithm = attrCertSeq.getObjectAt(0).toString();
- hashSigValue = attrCertSeq.getObjectAt(1).toString();
- }
-
- private void parseGenericCertId(final ASN1Sequence issuerSerialSeq) {
- //Check if it have a valid number of identifiers
- if (issuerSerialSeq.size() != SEQUENCE_NUMBER) {
- throw new IllegalArgumentException("CertificateIdentifier"
- + ".GenericCertificateIdentifier does not have required values.");
- }
-
- ASN1Sequence derSequence = DERSequence.getInstance(issuerSerialSeq.getObjectAt(0));
- ASN1TaggedObject taggedObj = ASN1TaggedObject.getInstance(derSequence.getObjectAt(0));
-
- issuerDN = GeneralName.getInstance(taggedObj);
- certificateSerialNumber = ASN1Integer.getInstance(issuerSerialSeq
- .getObjectAt(1)).getValue();
- }
-
- /**
- * String for the internal data stored.
- * @return String representation of the data.
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
-
- sb.append("CertificateIdentifier{");
- sb.append("hashAlgorithm=").append(hashAlgorithm);
- sb.append(", hashSigValue").append(hashSigValue);
- sb.append(", issuerDN=");
- if (issuerDN != null) {
- sb.append(issuerDN.toString());
- }
- sb.append(", certificateSerialNumber=");
- if (certificateSerialNumber != null) {
- sb.append(certificateSerialNumber.toString());
- }
-
- sb.append("}");
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/ComponentIdentifierV2.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/ComponentIdentifierV2.java
deleted file mode 100644
index ed8d1ceb..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/ComponentIdentifierV2.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes.V2;
-
-import hirs.attestationca.persist.entity.userdefined.certificate.attributes.ComponentAddress;
-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.URIReference;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-import org.bouncycastle.asn1.ASN1Boolean;
-import org.bouncycastle.asn1.ASN1Enumerated;
-import org.bouncycastle.asn1.ASN1ObjectIdentifier;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERUTF8String;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Basic class that handle component identifiers from the Platform Configuration
- * Attribute.
- *
- * ComponentIdentifier ::= SEQUENCE {
- * componentManufacturer UTF8String (SIZE (1..STRMAX)),
- * componentModel UTF8String (SIZE (1..STRMAX)),
- * componentSerial[0] IMPLICIT UTF8String (SIZE (1..STRMAX)) OPTIONAL,
- * componentRevision [1] IMPLICIT UTF8String (SIZE (1..STRMAX)) OPTIONAL,
- * componentManufacturerId [2] IMPLICIT PrivateEnterpriseNumber OPTIONAL,
- * fieldReplaceable [3] IMPLICIT BOOLEAN OPTIONAL,
- * componentAddress [4] IMPLICIT
- * SEQUENCE(SIZE(1..CONFIGMAX)) OF ComponentAddress OPTIONAL
- * componentPlatformCert [5] IMPLICIT CertificateIdentifier OPTIONAL,
- * componentPlatformCertUri [6] IMPLICIT URIReference OPTIONAL,
- * status [7] IMPLICIT AttributeStatus OPTIONAL }
- * where STRMAX is 256, CONFIGMAX is 32
- *
- */
-@Getter
-@Setter
-@EqualsAndHashCode
-public class ComponentIdentifierV2 extends ComponentIdentifier {
-
- private static final int MANDATORY_ELEMENTS = 3;
- // Additional optional identifiers for version 2
- private static final int COMPONENT_PLATFORM_CERT = 5;
- private static final int COMPONENT_PLATFORM_URI = 6;
- private static final int ATTRIBUTE_STATUS = 7;
-
- private ComponentClass componentClass;
- private CertificateIdentifier certificateIdentifier;
- private URIReference componentPlatformUri;
- private AttributeStatus attributeStatus;
-
- /**
- * Default constructor.
- */
- public ComponentIdentifierV2() {
- super();
- componentClass = new ComponentClass();
- certificateIdentifier = null;
- componentPlatformUri = null;
- attributeStatus = AttributeStatus.EMPTY_STATUS;
- }
-
- /**
- * Constructor given the components values.
- *
- * @param componentClass represent the component type
- * @param componentManufacturer represents the component manufacturer
- * @param componentModel represents the component model
- * @param componentSerial represents the component serial number
- * @param componentRevision represents the component revision
- * @param componentManufacturerId represents the component manufacturer ID
- * @param fieldReplaceable represents if the component is replaceable
- * @param componentAddress represents a list of addresses
- * @param certificateIdentifier object representing certificate Id
- * @param componentPlatformUri object containing the URI Reference
- * @param attributeStatus object containing enumerated status
- */
- @SuppressWarnings("checkstyle:parameternumber")
- public ComponentIdentifierV2(final ComponentClass componentClass,
- final DERUTF8String componentManufacturer,
- final DERUTF8String componentModel,
- final DERUTF8String componentSerial,
- final DERUTF8String componentRevision,
- final ASN1ObjectIdentifier componentManufacturerId,
- final ASN1Boolean fieldReplaceable,
- final List
- * PlatformConfiguration ::= SEQUENCE {
- * componentIdentifier [0] IMPLICIT SEQUENCE(SIZE(1..CONFIGMAX)) OF
- * ComponentIdentifier OPTIONAL,
- * componentIdentifiersUri [1] IMPLICIT URIReference OPTIONAL
- * platformProperties [2] IMPLICIT SEQUENCE(SIZE(1..CONFIGMAX)) OF Properties OPTIONAL,
- * platformPropertiesUri [3] IMPLICIT URIReference OPTIONAL }
- *
- */
-public class PlatformConfigurationV2 extends PlatformConfiguration {
-
- private static final int COMPONENT_IDENTIFIER = 0;
- private static final int COMPONENT_IDENTIFIER_URI = 1;
- private static final int PLATFORM_PROPERTIES = 2;
- private static final int PLATFORM_PROPERTIES_URI = 3;
-
- /**
- * Constructor given the SEQUENCE that contains Platform Configuration.
- * @param sequence containing the the Platform Configuration.
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public PlatformConfigurationV2(final ASN1Sequence sequence) throws IllegalArgumentException {
- //Default values
- setComponentIdentifier(new ArrayList<>());
- setComponentIdentifierUri(null);
- setPlatformProperties(new ArrayList<>());
- setPlatformPropertiesUri(null);
-
- for (int i = 0; i < sequence.size(); i++) {
- ASN1TaggedObject taggedSequence
- = ASN1TaggedObject.getInstance(sequence.getObjectAt(i));
- //Set information based on the set tagged
- switch (taggedSequence.getTagNo()) {
- case COMPONENT_IDENTIFIER:
- //Get componentIdentifier
- ASN1Sequence componentConfiguration
- = ASN1Sequence.getInstance(taggedSequence, false);
-
- //Get and set all the component values
- for (int j = 0; j < componentConfiguration.size(); j++) {
- //DERSequence with the components
- ASN1Sequence component
- = ASN1Sequence.getInstance(componentConfiguration.getObjectAt(j));
- add(new ComponentIdentifierV2(component));
- }
- break;
- case COMPONENT_IDENTIFIER_URI:
- //Get componentIdentifierURI
- ASN1Sequence componentUri = ASN1Sequence.getInstance(taggedSequence, false);
- //Save Component Identifier URI
- setComponentIdentifierUri(new URIReference(componentUri));
- break;
- case PLATFORM_PROPERTIES:
- //Get platformProperties
- ASN1Sequence properties = ASN1Sequence.getInstance(taggedSequence, false);
-
- //Get and set all the properties values
- for (int j = 0; j < properties.size(); j++) {
- //DERSequence with the components
- ASN1Sequence property = ASN1Sequence.getInstance(properties.getObjectAt(j));
- add(new PlatformPropertyV2(property));
- }
- break;
- case PLATFORM_PROPERTIES_URI:
- //Get platformPropertiesURI
- ASN1Sequence propertiesUri = ASN1Sequence.getInstance(taggedSequence, false);
- //Save properties URI
- setPlatformPropertiesUri(new URIReference(propertiesUri));
- break;
- default:
- break;
- }
- }
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("PlatformConfiguration{");
- sb.append("componentIdentifier=");
- if (getComponentIdentifier().size() > 0) {
- sb.append(getComponentIdentifier()
- .stream()
- .map(Object::toString)
- .collect(Collectors.joining(",")));
- }
- sb.append(", componentIdentifierUri=");
- if (getComponentIdentifierUri() != null) {
- sb.append(getComponentIdentifierUri().toString());
- }
- sb.append(", platformProperties=");
- if (getPlatformProperties().size() > 0) {
- sb.append(getPlatformProperties()
- .stream()
- .map(Object::toString)
- .collect(Collectors.joining(",")));
- }
- sb.append(", platformPropertiesUri=");
- if (getPlatformPropertiesUri() != null) {
- sb.append(getPlatformPropertiesUri().toString());
- }
- sb.append("}");
-
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/PlatformPropertyV2.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/PlatformPropertyV2.java
deleted file mode 100644
index b2edf6ef..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/PlatformPropertyV2.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes.V2;
-
-import hirs.attestationca.persist.entity.userdefined.certificate.attributes.PlatformProperty;
-import lombok.Getter;
-import lombok.Setter;
-import org.bouncycastle.asn1.ASN1Enumerated;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERUTF8String;
-
-/**
- *
- * Basic class that handles a single property for the platform configuration.
- *
- * Properties ::= SEQUENCE {
- * propertyName UTF8String (SIZE (1..STRMAX)),
- * propertyValue UTF8String (SIZE (1..STRMAX),
- * status [0] IMPLICIT AttributeStatus OPTIONAL }
- *
- *
- */
-public class PlatformPropertyV2 extends PlatformProperty {
-
- @Getter
- @Setter
- private AttributeStatus attributeStatus;
-
- /**
- * Default constructor.
- */
- public PlatformPropertyV2() {
- super();
- this.attributeStatus = AttributeStatus.EMPTY_STATUS;
- }
-
- /**
- * Constructor given the name and value for the platform property.
- *
- * @param propertyName string containing the property name
- * @param propertyValue string containing the property value
- * @param attributeStatus enumerated object with the status of the property
- */
- public PlatformPropertyV2(final DERUTF8String propertyName, final DERUTF8String propertyValue,
- final AttributeStatus attributeStatus) {
- super(propertyName, propertyValue);
- this.attributeStatus = attributeStatus;
- }
-
- /**
- * Constructor given the SEQUENCE that contains the name and value for the
- * platform property.
- *
- * @param sequence containing the name and value of the platform property
- * @throws IllegalArgumentException if there was an error on the parsing
- */
- public PlatformPropertyV2(final ASN1Sequence sequence) throws IllegalArgumentException {
- // Check if the sequence contains the two values required
- if (sequence.size() < IDENTIFIER_NUMBER) {
- throw new IllegalArgumentException("Platform properties does not contain all "
- + "the required fields.");
- }
-
- setPropertyName(DERUTF8String.getInstance(sequence.getObjectAt(0)));
- setPropertyValue(DERUTF8String.getInstance(sequence.getObjectAt(1)));
-
- // optional value which is a placeholder for now
- if (sequence.size() > IDENTIFIER_NUMBER
- && sequence.getObjectAt(2) instanceof ASN1Enumerated) {
- ASN1Enumerated enumerated = ASN1Enumerated.getInstance(sequence.getObjectAt(2));
- this.attributeStatus = AttributeStatus.values()[enumerated.getValue().intValue()];
- }
- }
-
- /**
- * @return true if the property has been modified.
- */
- public final boolean isModified() {
- return getAttributeStatus() == AttributeStatus.MODIFIED;
- }
-
- /**
- * @return true if the property has been removed.
- */
- public final boolean isRemoved() {
- return getAttributeStatus() != AttributeStatus.REMOVED;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("PlatformPropertyV2{");
- sb.append("PropertyName=").append(getPropertyName().getString());
- sb.append(", propertyValue=").append(getPropertyValue().getString());
- if (attributeStatus != null) {
- sb.append(", attributeStatus=").append(attributeStatus.toString());
- }
- sb.append("}");
-
- return sb.toString();
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/package-info.java
deleted file mode 100644
index 31789141..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/V2/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes.V2;
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/package-info.java
deleted file mode 100644
index 60bd347c..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/attributes/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate.attributes;
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/package-info.java
deleted file mode 100644
index 329c94d4..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/certificate/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.certificate;
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/FirmwareInfo.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/FirmwareInfo.java
deleted file mode 100644
index a6ae354d..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/FirmwareInfo.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.info;
-
-import hirs.attestationca.persist.entity.userdefined.report.DeviceInfoReport;
-import hirs.attestationca.utils.StringValidator;
-import jakarta.persistence.Column;
-import jakarta.xml.bind.annotation.XmlElement;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-
-import java.io.Serializable;
-
-/**
- * Used for representing the firmware info of a device, such as the BIOS information.
- */
-@ToString
-@EqualsAndHashCode
-@Getter
-public class FirmwareInfo implements Serializable {
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private final String biosVendor;
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private final String biosVersion;
-
- @XmlElement
- @Column(length = DeviceInfoReport.SHORT_STRING_LENGTH, nullable = false)
- private final String biosReleaseDate;
-
- /**
- * Constructor used to create a populated firmware info object.
- *
- * @param biosVendor String bios vendor name, i.e. Dell Inc.
- * @param biosVersion String bios version info, i.e. A11
- * @param biosReleaseDate String bios release date info, i.e. 03/12/2013
- */
- public FirmwareInfo(final String biosVendor, final String biosVersion,
- final String biosReleaseDate) {
- this.biosVendor = StringValidator.check(biosVendor, "biosVendor")
- .notBlank().maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
-
- this.biosVersion = StringValidator.check(biosVersion, "biosVersion")
- .notBlank().maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
-
- this.biosReleaseDate = StringValidator.check(biosReleaseDate, "biosReleaseDate")
- .notBlank().maxLength(DeviceInfoReport.SHORT_STRING_LENGTH).getValue();
- }
-
- /**
- * Default constructor, useful for hibernate and marshalling and unmarshalling.
- */
- public FirmwareInfo() {
- this(DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED);
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/HardwareInfo.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/HardwareInfo.java
deleted file mode 100644
index 8115f4d2..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/HardwareInfo.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.info;
-
-import hirs.attestationca.persist.entity.userdefined.report.DeviceInfoReport;
-import hirs.attestationca.utils.StringValidator;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.xml.bind.annotation.XmlElement;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.Serializable;
-
-/**
- * Used for representing the hardware info of a device.
- */
-@EqualsAndHashCode
-@Getter
-@Embeddable
-public class HardwareInfo implements Serializable {
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private String manufacturer = DeviceInfoReport.NOT_SPECIFIED;
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private String productName = DeviceInfoReport.NOT_SPECIFIED;
-
- @XmlElement
- @Column(length = DeviceInfoReport.MED_STRING_LENGTH, nullable = false)
- private String version = DeviceInfoReport.NOT_SPECIFIED;
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private String systemSerialNumber = DeviceInfoReport.NOT_SPECIFIED;
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private String chassisSerialNumber = DeviceInfoReport.NOT_SPECIFIED;
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private String baseboardSerialNumber = DeviceInfoReport.NOT_SPECIFIED;
-
- /**
- * Constructor used to create a populated firmware info object.
- *
- * @param manufacturer String manufacturer name
- * @param productName String product name info
- * @param version String bios release date info
- * @param systemSerialNumber String device serial number
- * @param chassisSerialNumber String device chassis serial number
- * @param baseboardSerialNumber String device baseboard serial number
- */
- public HardwareInfo(
- final String manufacturer,
- final String productName,
- final String version,
- final String systemSerialNumber,
- final String chassisSerialNumber,
- final String baseboardSerialNumber) {
- if (!StringUtils.isBlank(manufacturer)) {
- this.manufacturer = StringValidator.check(manufacturer, "manufacturer")
- .maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
- }
-
- if (!StringUtils.isBlank(productName)) {
- this.productName = StringValidator.check(productName, "productName")
- .maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
- }
-
- if (!StringUtils.isBlank(version)) {
- this.version = StringValidator.check(version, "version")
- .maxLength(DeviceInfoReport.MED_STRING_LENGTH).getValue();
- }
-
- if (!StringUtils.isBlank(systemSerialNumber)) {
- this.systemSerialNumber = StringValidator.check(systemSerialNumber,
- "systemSerialNumber")
- .maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
- }
-
- if (!StringUtils.isBlank(chassisSerialNumber)) {
- this.chassisSerialNumber = StringValidator.check(chassisSerialNumber,
- "chassisSerialNumber")
- .maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
- }
-
- if (!StringUtils.isBlank(baseboardSerialNumber)) {
- this.baseboardSerialNumber = StringValidator.check(
- baseboardSerialNumber, "baseboardSerialNumber")
- .maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
- }
- }
-
- /**
- * Default constructor, useful for hibernate and marshalling and unmarshalling.
- */
- public HardwareInfo() {
- this(
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED
- );
- }
-
- @Override
- public String toString() {
- return "HardwareInfo{"
- + "manufacturer='" + manufacturer + '\''
- + ", productName='" + productName + '\''
- + ", version='" + version + '\''
- + ", systemSerialNumber='" + systemSerialNumber + '\''
- + ", chassisSerialNumber='" + chassisSerialNumber + '\''
- + ", baseboardSerialNumber='" + baseboardSerialNumber + '\''
- + '}';
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/NetworkInfo.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/NetworkInfo.java
deleted file mode 100644
index c4b4be32..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/NetworkInfo.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.info;
-
-import hirs.attestationca.persist.entity.userdefined.report.DeviceInfoReport;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.xml.bind.annotation.XmlElement;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.hibernate.annotations.Type;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-
-/**
- * This class is used to represent the network info of a device.
- */
-@EqualsAndHashCode
-@Embeddable
-public class NetworkInfo implements Serializable {
-
- private static final Logger LOGGER = LogManager
- .getLogger(NetworkInfo.class);
-
- private static final int NUM_MAC_ADDRESS_BYTES = 6;
-
- @XmlElement
- @Setter
- @Getter
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = true)
- private String hostname;
-
- @XmlElement
- @XmlJavaTypeAdapter(value = InetAddressXmlAdapter.class)
- @Setter
- @Getter
- @Column(length = DeviceInfoReport.SHORT_STRING_LENGTH, nullable = true)
- @Type(type = "hirs.attestationca.persist.type.InetAddressType")
- private InetAddress ipAddress;
-
- @XmlElement
- @Column(length = NUM_MAC_ADDRESS_BYTES, nullable = true)
- @SuppressWarnings("checkstyle:magicnumber")
- private byte[] macAddress;
-
- /**
- * Constructor used to create a NetworkInfo object.
- *
- * @param hostname
- * String representing the hostname information for the device,
- * can be null if hostname unknown
- * @param ipAddress
- * InetAddress object representing the IP address for the device,
- * can be null if IP address unknown
- * @param macAddress
- * byte array representing the MAC address for the device, can be
- * null if MAC address is unknown
- */
- public NetworkInfo(final String hostname, final InetAddress ipAddress,
- final byte[] macAddress) {
- setHostname(hostname);
- setIpAddress(ipAddress);
- setMacAddress(macAddress);
- }
-
- /**
- * Default constructor necessary for marshalling/unmarshalling XML objects.
- */
- protected NetworkInfo() {
- this.hostname = null;
- this.ipAddress = null;
- this.macAddress = null;
- }
-
- /**
- * Used to retrieve the MAC address of the device.
- *
- * @return a String representing the MAC address, may return null if no
- * value is set
- */
- public final byte[] getMacAddress() {
- if (macAddress == null) {
- return null;
- } else {
- return macAddress.clone();
- }
- }
-
- private void setMacAddress(final byte[] macAddress) {
- StringBuilder sb;
- if (macAddress == null) {
- sb = null;
- } else {
- if (macAddress.length != NUM_MAC_ADDRESS_BYTES) {
- LOGGER.error(
- "MAC address is only {} bytes, must be {} bytes or "
- + "null", macAddress.length,
- NUM_MAC_ADDRESS_BYTES);
- throw new IllegalArgumentException(
- "MAC address is invalid size");
- }
- sb = new StringBuilder();
- for (byte b : macAddress) {
- sb.append(String.format("%02X ", b));
- }
- }
- LOGGER.debug("setting MAC address to: {}", sb);
- this.macAddress = macAddress;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/OSInfo.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/OSInfo.java
deleted file mode 100644
index 3c1d5334..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/OSInfo.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.info;
-
-import hirs.attestationca.persist.entity.userdefined.report.DeviceInfoReport;
-import hirs.attestationca.utils.StringValidator;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.xml.bind.annotation.XmlElement;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.io.Serializable;
-
-/**
- * This class is used to represent the OS info of a device.
- */
-@EqualsAndHashCode
-@ToString
-@Getter
-@Embeddable
-public class OSInfo implements Serializable {
- private static final Logger LOGGER = LogManager.getLogger(OSInfo.class);
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private final String osName;
-
- @XmlElement
- @Column(length = DeviceInfoReport.LONG_STRING_LENGTH, nullable = false)
- private final String osVersion;
-
- @XmlElement
- @Column(length = DeviceInfoReport.SHORT_STRING_LENGTH, nullable = false)
- private final String osArch;
-
- @XmlElement
- @Column(length = DeviceInfoReport.SHORT_STRING_LENGTH, nullable = true)
- private final String distribution;
-
- @XmlElement
- @Column(length = DeviceInfoReport.SHORT_STRING_LENGTH, nullable = true)
- private final String distributionRelease;
-
- /**
- * Constructor used to create an OSInfo object. This constructor takes an OS
- * name (Linux | Mac OS X | Windows 7), an OS version (i.e.
- * 3.10.0-123.el7.x86_64), OS architecture (x86_64), distribution (CentOS |
- * Fedora), and distribution release (7.0.1406). Distribution only makes
- * sense for Linux, so distribution and distributionRelease may be null.
- *
- * @param osName
- * String OS name (Linux | Mac OS X | Windows 7)
- * @param osVersion
- * String OS version (i.e. 3.10.0-123.el7.x86_64)
- * @param osArch
- * String OS architecture (x86_64)
- * @param distribution
- * String distribution (CentOS | Fedora)
- * @param distributionRelease
- * String distribution release (7.0.1406)
- */
- public OSInfo(final String osName, final String osVersion,
- final String osArch, final String distribution,
- final String distributionRelease) {
- LOGGER.debug("setting OS name information to: {}", osName);
- this.osName = StringValidator.check(osName, "osName")
- .notNull().maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
-
- LOGGER.debug("setting OS version information to: {}", osVersion);
- this.osVersion = StringValidator.check(osVersion, "osVersion")
- .notNull().maxLength(DeviceInfoReport.LONG_STRING_LENGTH).getValue();
-
- LOGGER.debug("setting OS arch information to: {}", osArch);
- this.osArch = StringValidator.check(osArch, "osArch")
- .notNull().maxLength(DeviceInfoReport.SHORT_STRING_LENGTH).getValue();
-
- LOGGER.debug("setting OS distribution information to: {}", distribution);
- this.distribution = StringValidator.check(distribution, "distribution")
- .maxLength(DeviceInfoReport.SHORT_STRING_LENGTH).getValue();
-
- LOGGER.debug("setting OS distribution release information to: {}",
- distributionRelease);
- this.distributionRelease = StringValidator.check(distributionRelease, "distributionRelease")
- .maxLength(DeviceInfoReport.SHORT_STRING_LENGTH).getValue();
- }
-
- /**
- * Default constructor necessary for marshalling/unmarshalling XML objects.
- */
- public OSInfo() {
- this(DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED);
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/RIMInfo.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/RIMInfo.java
deleted file mode 100644
index a4ba39e8..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/RIMInfo.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.info;
-
-import hirs.attestationca.persist.entity.userdefined.report.DeviceInfoReport;
-import hirs.attestationca.utils.StringValidator;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.xml.bind.annotation.XmlElement;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-
-import java.io.Serializable;
-
-@Getter
-@EqualsAndHashCode
-@Embeddable
-public class RIMInfo implements Serializable {
-
- @XmlElement
- @Column(length = DeviceInfoReport.MED_STRING_LENGTH, nullable = false)
- private final String rimManufacturer;
-
- @XmlElement
- @Column(length = DeviceInfoReport.MED_STRING_LENGTH, nullable = false)
- private final String model;
-
- @XmlElement
- @Column(length = DeviceInfoReport.MED_STRING_LENGTH, nullable = false)
- private final String fileHash;
-
- @XmlElement
- @Column(length = DeviceInfoReport.MED_STRING_LENGTH, nullable = false)
- private final String pcrHash;
-
- /**
- * Constructor for the initial values of the class.
- * @param rimManufacturer string of the rimManufacturer
- * @param model string of the model
- * @param fileHash string of the file hash
- * @param pcrHash string of the pcr hash
- */
- public RIMInfo(final String rimManufacturer, final String model,
- final String fileHash, final String pcrHash) {
- this.rimManufacturer = StringValidator.check(rimManufacturer, "rimManufacturer")
- .notBlank().maxLength(DeviceInfoReport.MED_STRING_LENGTH).getValue();
- this.model = StringValidator.check(model, "model")
- .notBlank().maxLength(DeviceInfoReport.MED_STRING_LENGTH).getValue();
- this.fileHash = StringValidator.check(fileHash, "fileHash")
- .notBlank().maxLength(DeviceInfoReport.MED_STRING_LENGTH).getValue();
- this.pcrHash = StringValidator.check(pcrHash, "pcrHash")
- .notBlank().maxLength(DeviceInfoReport.MED_STRING_LENGTH).getValue();
- }
-
- /**
- * Default no parameter constructor.
- */
- public RIMInfo() {
- this(DeviceInfoReport.NOT_SPECIFIED, DeviceInfoReport.NOT_SPECIFIED,
- DeviceInfoReport.NOT_SPECIFIED, DeviceInfoReport.NOT_SPECIFIED);
- }
-
- @Override
- public String toString() {
- return String.format("%s, %s, %s, %s", rimManufacturer, model,
- fileHash, pcrHash);
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/TPMInfo.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/TPMInfo.java
deleted file mode 100644
index 7e81eec9..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/info/TPMInfo.java
+++ /dev/null
@@ -1,316 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import hirs.attestationca.persist.entity.userdefined.report.DeviceInfoReport;
-import hirs.attestationca.utils.StringValidator;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.persistence.Lob;
-import jakarta.xml.bind.annotation.XmlElement;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.io.Serializable;
-import java.security.cert.X509Certificate;
-
-/**
- * This class is used to represent the TPM information for a device.
- */
-@Getter
-@EqualsAndHashCode
-@Embeddable
-public class TPMInfo implements Serializable {
- private static final Logger LOGGER = LogManager.getLogger(TPMInfo.class);
- private static final int MAX_BLOB_SIZE = 65535;
-
- @XmlElement
- @Column(length = DeviceInfoReport.MED_STRING_LENGTH, nullable = true)
- private String tpmMake;
-
- @XmlElement
- @Column(nullable = true)
- private short tpmVersionMajor;
-
- @XmlElement
- @Column(nullable = true)
- private short tpmVersionMinor;
-
- @XmlElement
- @Column(nullable = true)
- private short tpmVersionRevMajor;
-
- @XmlElement
- @Column(nullable = true)
- private short tpmVersionRevMinor;
-
- @XmlElement
-// @XmlJavaTypeAdapter(X509CertificateAdapter.class)
- @Lob
-// @Type(type = "hirs.attestationca.persist.type.X509CertificateType")
- @JsonIgnore
- private X509Certificate identityCertificate;
-
- @Column(nullable = true, length = MAX_BLOB_SIZE)
- private byte[] pcrValues;
-
- @Column(nullable = true, length = MAX_BLOB_SIZE)
- private byte[] tpmQuoteHash;
-
- @Column(nullable = true, length = MAX_BLOB_SIZE)
- private byte[] tpmQuoteSignature;
-
- /**
- * Constructor used to create a TPMInfo object.
- *
- * @param tpmMake
- * String representing the make information for the TPM,
- * NullPointerException thrown if null
- * @param tpmVersionMajor
- * short representing the major version number for the TPM
- * @param tpmVersionMinor
- * short representing the minor version number for the TPM
- * @param tpmVersionRevMajor
- * short representing the major revision number for the TPM
- * @param tpmVersionRevMinor
- * short representing the minor revision number for the TPM
- * @param identityCertificate
- * byte array with the value of the identity certificate
- * @param pcrValues
- * short representing the major revision number for the TPM
- * @param tpmQuoteHash
- * short representing the minor revision number for the TPM
- * @param tpmQuoteSignature
- * byte array with the value of the identity certificate
- */
- @SuppressWarnings("parameternumber")
- public TPMInfo(final String tpmMake, final short tpmVersionMajor,
- final short tpmVersionMinor, final short tpmVersionRevMajor,
- final short tpmVersionRevMinor,
- final X509Certificate identityCertificate, final byte[] pcrValues,
- final byte[] tpmQuoteHash, final byte[] tpmQuoteSignature) {
- setTPMMake(tpmMake);
- setTPMVersionMajor(tpmVersionMajor);
- setTPMVersionMinor(tpmVersionMinor);
- setTPMVersionRevMajor(tpmVersionRevMajor);
- setTPMVersionRevMinor(tpmVersionRevMinor);
- setIdentityCertificate(identityCertificate);
- setPcrValues(pcrValues);
- setTpmQuoteHash(tpmQuoteHash);
- setTpmQuoteSignature(tpmQuoteSignature);
- }
-
- /**
- * Constructor used to create a TPMInfo object without an identity
- * certificate.
- *
- * @param tpmMake
- * String representing the make information for the TPM,
- * NullPointerException thrown if null
- * @param tpmVersionMajor
- * short representing the major version number for the TPM
- * @param tpmVersionMinor
- * short representing the minor version number for the TPM
- * @param tpmVersionRevMajor
- * short representing the major revision number for the TPM
- * @param tpmVersionRevMinor
- * short representing the minor revision number for the TPM
- * @param pcrValues
- * short representing the major revision number for the TPM
- * @param tpmQuoteHash
- * short representing the minor revision number for the TPM
- * @param tpmQuoteSignature
- * byte array with the value of the identity certificate
- */
- @SuppressWarnings("parameternumber")
- public TPMInfo(final String tpmMake, final short tpmVersionMajor,
- final short tpmVersionMinor, final short tpmVersionRevMajor,
- final short tpmVersionRevMinor, final byte[] pcrValues,
- final byte[] tpmQuoteHash, final byte[] tpmQuoteSignature) {
- setTPMMake(tpmMake);
- setTPMVersionMajor(tpmVersionMajor);
- setTPMVersionMinor(tpmVersionMinor);
- setTPMVersionRevMajor(tpmVersionRevMajor);
- setTPMVersionRevMinor(tpmVersionRevMinor);
- setPcrValues(pcrValues);
- setTpmQuoteHash(tpmQuoteHash);
- setTpmQuoteSignature(tpmQuoteSignature);
- }
-
- /**
- * Constructor used to create a TPMInfo object without an identity
- * certificate.
- *
- * @param tpmMake
- * String representing the make information for the TPM,
- * NullPointerException thrown if null
- * @param tpmVersionMajor
- * short representing the major version number for the TPM
- * @param tpmVersionMinor
- * short representing the minor version number for the TPM
- * @param tpmVersionRevMajor
- * short representing the major revision number for the TPM
- * @param tpmVersionRevMinor
- * short representing the minor revision number for the TPM
- */
- public TPMInfo(final String tpmMake, final short tpmVersionMajor,
- final short tpmVersionMinor, final short tpmVersionRevMajor,
- final short tpmVersionRevMinor) {
- this(tpmMake, tpmVersionMajor, tpmVersionMinor, tpmVersionRevMajor,
- tpmVersionRevMinor, null,
- new byte[0], new byte[0], new byte[0]);
- }
-
- /**
- * Constructor used to create a TPMInfo object without an identity
- * certificate.
- *
- * @param tpmMake
- * String representing the make information for the TPM,
- * NullPointerException thrown if null
- * @param tpmVersionMajor
- * short representing the major version number for the TPM
- * @param tpmVersionMinor
- * short representing the minor version number for the TPM
- * @param tpmVersionRevMajor
- * short representing the major revision number for the TPM
- * @param tpmVersionRevMinor
- * short representing the minor revision number for the TPM
- * @param identityCertificate
- * byte array with the value of the identity certificate
- */
- public TPMInfo(final String tpmMake, final short tpmVersionMajor,
- final short tpmVersionMinor, final short tpmVersionRevMajor,
- final short tpmVersionRevMinor,
- final X509Certificate identityCertificate) {
- this(tpmMake, tpmVersionMajor, tpmVersionMinor, tpmVersionRevMajor,
- tpmVersionRevMinor, identityCertificate,
- new byte[0], new byte[0], new byte[0]);
- }
-
- /**
- * Default constructor used for marshalling/unmarshalling XML objects.
- */
- public TPMInfo() {
- this(DeviceInfoReport.NOT_SPECIFIED,
- (short) 0,
- (short) 0,
- (short) 0,
- (short) 0,
- new byte[0],
- new byte[0],
- new byte[0]);
- identityCertificate = null;
- }
-
- /**
- * Getter for the tpmQuote passed up by the client.
- * @return a byte blob of quote
- */
- public final byte[] getTpmQuoteHash() {
- return tpmQuoteHash.clone();
- }
-
- /**
- * Getter for the quote signature.
- * @return a byte blob.
- */
- public final byte[] getTpmQuoteSignature() {
- return tpmQuoteSignature.clone();
- }
-
- /**
- * Getter for the pcr values.
- * @return a byte blob for the pcrValues.
- */
- public final byte[] getPcrValues() {
- return pcrValues.clone();
- }
-
- private void setTPMMake(final String tpmMake) {
- LOGGER.debug("setting TPM make info: {}", tpmMake);
- this.tpmMake = StringValidator.check(tpmMake, "tpmMake")
- .notNull().maxLength(DeviceInfoReport.MED_STRING_LENGTH).getValue();
- }
-
- private void setTPMVersionMajor(final short tpmVersionMajor) {
- if (tpmVersionMajor < 0) {
- LOGGER.error("TPM major version number cannot be negative: {}",
- tpmVersionMajor);
- throw new IllegalArgumentException(
- "negative TPM major version number");
- }
- LOGGER.debug("setting TPM major version number: {}", tpmVersionMajor);
- this.tpmVersionMajor = tpmVersionMajor;
- }
-
- private void setTPMVersionMinor(final short tpmVersionMinor) {
- if (tpmVersionMinor < 0) {
- LOGGER.error("TPM minor version number cannot be negative: {}",
- tpmVersionMinor);
- throw new IllegalArgumentException(
- "negative TPM minor version number");
- }
- LOGGER.debug("setting TPM minor version number: {}", tpmVersionMinor);
- this.tpmVersionMinor = tpmVersionMinor;
- }
-
- private void setTPMVersionRevMajor(final short tpmVersionRevMajor) {
- if (tpmVersionRevMajor < 0) {
- LOGGER.error("TPM major revision number cannot be negative: {}",
- tpmVersionRevMajor);
- throw new IllegalArgumentException(
- "negative TPM major revision number");
- }
- LOGGER.debug("setting TPM major revision version number: {}",
- tpmVersionRevMajor);
- this.tpmVersionRevMajor = tpmVersionRevMajor;
- }
-
- private void setTPMVersionRevMinor(final short tpmVersionRevMinor) {
- if (tpmVersionRevMinor < 0) {
- LOGGER.error("TPM minor revision number cannot be negative: {}",
- tpmVersionRevMinor);
- throw new IllegalArgumentException(
- "negative TPM minor revision number");
- }
- LOGGER.debug("setting TPM minor revision version number: {}",
- tpmVersionRevMinor);
- this.tpmVersionRevMinor = tpmVersionRevMinor;
- }
-
- private void setIdentityCertificate(
- final X509Certificate identityCertificate) {
- if (identityCertificate == null) {
- LOGGER.error("identity certificate cannot be null");
- throw new NullPointerException("identityCertificate");
- }
- LOGGER.debug("setting identity certificate");
- this.identityCertificate = identityCertificate;
- }
-
- private void setPcrValues(final byte[] pcrValues) {
- if (pcrValues == null) {
- this.pcrValues = new byte[0];
- } else {
- this.pcrValues = pcrValues.clone();
- }
- }
-
- private void setTpmQuoteHash(final byte[] tpmQuoteHash) {
- if (tpmQuoteHash == null) {
- this.tpmQuoteHash = new byte[0];
- } else {
- this.tpmQuoteHash = tpmQuoteHash.clone();
- }
- }
-
- private void setTpmQuoteSignature(final byte[] tpmQuoteSignature) {
- if (tpmQuoteSignature == null) {
- this.tpmQuoteSignature = new byte[0];
- } else {
- this.tpmQuoteSignature = tpmQuoteSignature.clone();
- }
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/package-info.java
deleted file mode 100644
index 227f37fd..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined;
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/report/DeviceInfoReport.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/report/DeviceInfoReport.java
deleted file mode 100644
index 37cfe135..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/report/DeviceInfoReport.java
+++ /dev/null
@@ -1,289 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.report;
-
-import hirs.attestationca.persist.entity.userdefined.Report;
-import hirs.attestationca.persist.entity.userdefined.info.FirmwareInfo;
-import hirs.attestationca.persist.entity.userdefined.info.HardwareInfo;
-import hirs.attestationca.persist.entity.userdefined.info.NetworkInfo;
-import hirs.attestationca.persist.entity.userdefined.info.OSInfo;
-import hirs.attestationca.persist.entity.userdefined.info.TPMInfo;
-import hirs.attestationca.utils.VersionHelper;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embedded;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Transient;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.io.Serializable;
-import java.util.logging.Logger;
-
-import static org.apache.logging.log4j.LogManager.getLogger;
-
-/**
- * A DeviceInfoReport
is a Report
used to transfer the
- * information about the device. This Report
includes the network,
- * OS, and TPM information.
- */
-@Entity
-public class DeviceInfoReport extends Report implements Serializable {
-
- private static final Logger LOGGER = getLogger(DeviceInfoReport.class);
-
- /**
- * A variable used to describe unavailable hardware, firmware, or OS info.
- */
- public static final String NOT_SPECIFIED = "Not Specified";
- /**
- * Constant variable representing the various Short sized strings.
- */
- public static final int SHORT_STRING_LENGTH = 32;
- /**
- * Constant variable representing the various Medium sized strings.
- */
- public static final int MED_STRING_LENGTH = 64;
- /**
- * Constant variable representing the various Long sized strings.
- */
- public static final int LONG_STRING_LENGTH = 255;
-
- @Embedded
- private NetworkInfo networkInfo;
-
- @Embedded
- private OSInfo osInfo;
-
- @Embedded
- private FirmwareInfo firmwareInfo;
-
- @Embedded
- private HardwareInfo hardwareInfo;
-
- @Embedded
- private TPMInfo tpmInfo;
-
- @Getter
- @Column(nullable = false)
- private String clientApplicationVersion;
-
- @Getter
- @Setter
- @Transient
- private String paccorOutputString;
-
- /**
- * Default constructor necessary for marshalling/unmarshalling.
- */
- public DeviceInfoReport() {
- /* do nothing */
- }
-
- /**
- * Constructor used to create a DeviceInfoReport
. The
- * information cannot be changed after the DeviceInfoReport
is
- * created.
- *
- * @param networkInfo
- * NetworkInfo object, cannot be null
- * @param osInfo
- * OSInfo object, cannot be null
- * @param firmwareInfo
- * FirmwareInfo object, cannot be null
- * @param hardwareInfo
- * HardwareInfo object, cannot be null
- * @param tpmInfo
- * TPMInfo object, may be null if a TPM is not available on the
- * device
- */
- public DeviceInfoReport(final NetworkInfo networkInfo, final OSInfo osInfo,
- final FirmwareInfo firmwareInfo, final HardwareInfo hardwareInfo,
- final TPMInfo tpmInfo) {
- this(networkInfo, osInfo, firmwareInfo, hardwareInfo, tpmInfo, VersionHelper.getVersion());
- }
-
- /**
- * Constructor used to create a DeviceInfoReport
. The
- * information cannot be changed after the DeviceInfoReport
is
- * created.
- *
- * @param networkInfo
- * NetworkInfo object, cannot be null
- * @param osInfo
- * OSInfo object, cannot be null
- * @param firmwareInfo
- * FirmwareInfo object, cannot be null
- * @param hardwareInfo
- * HardwareInfo object, cannot be null
- * @param tpmInfo
- * TPMInfo object, may be null if a TPM is not available on the
- * device
- * @param clientApplicationVersion
- * string representing the version of the client that submitted this report,
- * cannot be null
- */
- public DeviceInfoReport(final NetworkInfo networkInfo, final OSInfo osInfo,
- final FirmwareInfo firmwareInfo, final HardwareInfo hardwareInfo,
- final TPMInfo tpmInfo, final String clientApplicationVersion) {
- setNetworkInfo(networkInfo);
- setOSInfo(osInfo);
- setFirmwareInfo(firmwareInfo);
- setHardwareInfo(hardwareInfo);
- setTPMInfo(tpmInfo);
- this.clientApplicationVersion = clientApplicationVersion;
- }
-
- /**
- * Retrieves the NetworkInfo for this DeviceInfoReport
.
- *
- * @return networkInfo
- */
- public final NetworkInfo getNetworkInfo() {
- /*
- * Hibernate bug requires this
- * https://hibernate.atlassian.net/browse/HHH-7610
- * without null may be returned, which this interface does not support
- */
- if (networkInfo == null) {
- networkInfo = new NetworkInfo(null, null, null);
- }
- return networkInfo;
- }
-
- /**
- * Retrieves the OSInfo for this DeviceInfoReport
.
- *
- * @return osInfo
- */
- public final OSInfo getOSInfo() {
- /*
- * Hibernate bug requires this
- * https://hibernate.atlassian.net/browse/HHH-7610
- * without null may be returned, which this interface does not support
- */
- if (osInfo == null) {
- osInfo = new OSInfo(NOT_SPECIFIED, NOT_SPECIFIED,
- NOT_SPECIFIED, NOT_SPECIFIED, NOT_SPECIFIED);
- }
- return osInfo;
- }
-
- /**
- * Retrieves the FirmwareInfo for this DeviceInfoReport
.
- *
- * @return osInfo
- */
- public final FirmwareInfo getFirmwareInfo() {
- /*
- * Hibernate bug requires this
- * https://hibernate.atlassian.net/browse/HHH-7610
- * without null may be returned, which this interface does not support
- */
- if (firmwareInfo == null) {
- firmwareInfo = new FirmwareInfo(NOT_SPECIFIED,
- NOT_SPECIFIED, NOT_SPECIFIED);
- }
- return firmwareInfo;
- }
-
- /**
- * Retrieves the OSInfo for this DeviceInfoReport
.
- *
- * @return osInfo
- */
- public HardwareInfo getHardwareInfo() {
- /*
- * Hibernate bug requires this
- * https://hibernate.atlassian.net/browse/HHH-7610
- * without null may be returned, which this interface does not support
- */
- if (hardwareInfo == null) {
- hardwareInfo = new HardwareInfo(
- NOT_SPECIFIED,
- NOT_SPECIFIED,
- NOT_SPECIFIED,
- NOT_SPECIFIED,
- NOT_SPECIFIED,
- NOT_SPECIFIED
- );
- }
- return hardwareInfo;
- }
-
- /**
- * Retrieves the TPMInfo for this DeviceInfoReport
. TPMInfo may
- * be null if a TPM is not available on the device.
- *
- * @return tpmInfo, may be null if a TPM is not available on the device
- */
- public final TPMInfo getTPMInfo() {
- return tpmInfo;
- }
-
- @Override
- public String getReportType() {
- return this.getClass().getName();
- }
-
- /**
- * Searches the given set of TPMBaselines for matching device info fields that
- * are determined critical to detecting a kernel update.
- * @param tpmBaselines Iterable<TPMBaseline> set of TPMBaseline objects.
- * @return True, if one of the TPM baselines in the set has the same kernel-specific
- * info as this DeviceinfoReport.
- */
- public final boolean matchesKernelInfo(final IterableCertificateValidationResult
represents the result of a certificate validation
- * operation.
- *
- */
-@Getter
-@Setter
-public class CertificateValidationResult {
- /**
- * Enum used to represent certificate validation status.
- */
- public enum CertificateValidationStatus {
-
- /**
- * Represents a passing validation.
- */
- PASS,
-
- /**
- * Represents a failed validation.
- */
- FAIL,
-
- /**
- * Represents a validation error.
- */
- ERROR
- }
-
- private CertificateValidationStatus validationStatus;
- private String validationResultMessage;
-
-
- /**
- * Sets the certificate validation status and result message.
- *
- * @param status enum representing the certificate validation status
- * @param resultMessage String representing certificate validation message
- */
- public final void setCertValidationStatusAndResultMessage(
- final CertificateValidationStatus status,
- final String resultMessage) {
- this.validationStatus = status;
- this.validationResultMessage = resultMessage;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/BaseReferenceManifest.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/BaseReferenceManifest.java
deleted file mode 100644
index 72419a3f..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/entity/userdefined/rim/BaseReferenceManifest.java
+++ /dev/null
@@ -1,390 +0,0 @@
-package hirs.attestationca.portal.persist.entity.userdefined.rim;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import hirs.attestationca.persist.entity.userdefined.ReferenceManifest;
-import hirs.attestationca.persist.service.ReferenceManifestServiceImpl;
-import hirs.attestationca.utils.SwidResource;
-import hirs.attestationca.utils.xjc.BaseElement;
-import hirs.attestationca.utils.xjc.Directory;
-import hirs.attestationca.utils.xjc.File;
-import hirs.attestationca.utils.xjc.FilesystemItem;
-import hirs.attestationca.utils.xjc.Link;
-import hirs.attestationca.utils.xjc.Meta;
-import hirs.attestationca.utils.xjc.ResourceCollection;
-import hirs.attestationca.utils.xjc.SoftwareIdentity;
-import hirs.attestationca.utils.xjc.SoftwareMeta;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.xml.bind.JAXBContext;
-import jakarta.xml.bind.JAXBElement;
-import jakarta.xml.bind.JAXBException;
-import jakarta.xml.bind.UnmarshalException;
-import jakarta.xml.bind.Unmarshaller;
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.validation.Schema;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Base64;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-@Getter
-@Setter
-@NoArgsConstructor(access = AccessLevel.PROTECTED)
-@Entity
-public class BaseReferenceManifest extends ReferenceManifest {
-
- private static final Logger LOGGER = LogManager.getLogger(BaseReferenceManifest.class);
- /**
- * Holds the name of the 'base64Hash' field.
- */
- public static final String BASE_64_HASH_FIELD = "base64Hash";
-
- private static JAXBContext jaxbContext;
-
- @Column
- @JsonIgnore
- private String base64Hash = "";
- @Column
- private String swidName = null;
- @Column
- private int swidCorpus = 0;
- @Column
- private String colloquialVersion = null;
- @Column
- private String product = null;
- @Column
- private String revision = null;
- @Column
- private String edition = null;
- @Column
- private String rimLinkHash = null;
- @Column
- private String bindingSpec = null;
- @Column
- private String bindingSpecVersion = null;
- @Column
- private String platformVersion = null;
- @Column
- private String payloadType = null;
- @Column
- private String pcURIGlobal = null;
- @Column
- private String pcURILocal = null;
-
- private String entityName = null;
- private String entityRegId = null;
- private String entityRole = null;
- private String entityThumbprint = null;
- private String linkHref = null;
- private String linkRel = null;
-
- /**
- * Support constructor for the RIM object.
- *
- * @param fileName - string representation of the uploaded file.
- * @param rimBytes - the file content of the uploaded file.
- * @throws java.io.IOException - thrown if the file is invalid.
- */
- public BaseReferenceManifest(final String fileName, final byte[] rimBytes) throws IOException {
- this(rimBytes);
- this.setFileName(fileName);
- }
-
- /**
- * Main constructor for the RIM object. This takes in a byte array of a
- * valid swidtag file and parses the information.
- *
- * @param rimBytes byte array representation of the RIM
- * @throws java.io.IOException if unable to unmarshal the string
- */
- @SuppressWarnings("checkstyle:AvoidInlineConditionals")
- public BaseReferenceManifest(final byte[] rimBytes) throws IOException {
- super(rimBytes);
- this.setRimType(BASE_RIM);
- this.setFileName("");
- SoftwareIdentity si = validateSwidTag(new ByteArrayInputStream(rimBytes));
-
- MessageDigest digest = null;
- this.base64Hash = "";
- try {
- digest = MessageDigest.getInstance("SHA-256");
- this.base64Hash = Base64.getEncoder().encodeToString(
- digest.digest(rimBytes));
- } catch (NoSuchAlgorithmException noSaEx) {
- LOGGER.error(noSaEx);
- }
-
- // begin parsing valid swid tag
- if (si != null) {
- setTagId(si.getTagId());
- this.swidName = si.getName();
- this.swidCorpus = si.isCorpus() ? 1 : 0;
- this.setSwidPatch(si.isPatch());
- this.setSwidSupplemental(si.isSupplemental());
- this.setSwidVersion(si.getVersion());
- if (si.getTagVersion() != null) {
- this.setSwidTagVersion(si.getTagVersion().toString());
- }
-
- for (Object object : si.getEntityOrEvidenceOrLink()) {
- if (object instanceof JAXBElement) {
- JAXBElement element = (JAXBElement) object;
- String elementName = element.getName().getLocalPart();
- switch (elementName) {
- case "Meta":
- parseSoftwareMeta((SoftwareMeta) element.getValue());
- break;
- case "Entity":
- hirs.attestationca.utils.xjc.Entity entity
- = (hirs.attestationca.utils.xjc.Entity) element.getValue();
- if (entity != null) {
- this.entityName = entity.getName();
- this.entityRegId = entity.getRegid();
- StringBuilder sb = new StringBuilder();
- for (String role : entity.getRole()) {
- sb.append(String.format("%s%n", role));
- }
- this.entityRole = sb.toString();
- this.entityThumbprint = entity.getThumbprint();
- }
- break;
- case "Link":
- Link link
- = (Link) element.getValue();
- if (link != null) {
- this.linkHref = link.getHref();
- this.linkRel = link.getRel();
- }
- break;
- case "Payload":
- parseResource((ResourceCollection) element.getValue());
- break;
- case "Signature":
- // left blank for a followup issue enhancement
- default:
- }
- }
- }
- }
- }
-
- /**
- * This is a helper method that parses the SoftwareMeta tag and stores the
- * information in the class fields.
- *
- * @param softwareMeta The object to parse.
- */
- private void parseSoftwareMeta(final SoftwareMeta softwareMeta) {
- if (softwareMeta != null) {
- for (Map.EntryHealthStatus
is used to represent the health of a device.
- */
-public enum HealthStatus {
- /**
- * The trusted state, no issues with the device.
- */
- TRUSTED("trusted"),
-
- /**
- * The untrusted state, there is a problem with the device.
- */
- UNTRUSTED("untrusted"),
-
- /**
- * A state for when the health has not been calculated yet.
- */
- UNKNOWN("unknown");
-
- private String healthStatus;
-
- /**
- * Creates a new HealthStatus
object given a String.
- *
- * @param healthStatus
- * "trusted", "untrusted", or "unknown"
- */
- HealthStatus(final String healthStatus) {
- this.healthStatus = healthStatus;
- }
-
- /**
- * Returns the health status.
- *
- * @return the status
- */
- public String getStatus() {
- return this.healthStatus;
- }
-
- @Override
- public String toString() {
- return getStatus();
- }
-
- public static boolean isValidStatus(final String healthStatus) {
- return Arrays.stream(HealthStatus.values())
- .map(HealthStatus::name)
- .collect(Collectors.toSet())
- .contains(healthStatus);
- }
-}
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/Page.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/Page.java
deleted file mode 100644
index 86749b23..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/Page.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package hirs.attestationca.portal.persist.enums;
-
-import hirs.attestationca.utils.VersionHelper;
-
-/**
- * Contains attributes required to display a portal page and its menu link.
- */
-public enum Page {
-
- /**
- * Site landing page.
- */
- INDEX("HIRS Attestation CA", "Version: " + VersionHelper.getVersion(),
- null, false, false, null, null),
- /**
- * Page to display registered devices.
- */
- DEVICES("Devices", "ic_devices", "first"),
- /**
- * Page that manages Attestation CA Policy.
- */
- POLICY("Policy", "ic_subtitles"),
- /**
- * Help page.
- */
- HELP("Help", "ic_live_help");
-
- private final String title;
- private final String subtitle;
- private final String icon;
-
- private final boolean hasMenu;
- private final String menuLinkClass;
- private final boolean inMenu;
-
- private final String prefixPath;
- private final String viewName;
-
- /**
- * Constructor for Page.
- *
- * @param title title of the page
- * @param subtitle subtitle of the page
- * @param icon icon for the page
- * @param hasMenu the page has its own menu
- * @param inMenu the page appears in a menu
- * @param menuLinkClass the category to which this page belongs
- * @param prefixPath prefix path that appears in the URL for this page
- */
- Page(final String title,
- final String subtitle,
- final String icon,
- final boolean hasMenu,
- final boolean inMenu,
- final String menuLinkClass,
- final String prefixPath) {
- this.title = title;
- this.subtitle = subtitle;
- this.icon = icon;
- this.hasMenu = hasMenu;
- this.menuLinkClass = menuLinkClass;
- this.inMenu = inMenu;
- this.prefixPath = prefixPath;
-
- viewName = this.name().toLowerCase().replaceAll("_", "-");
- }
-
- /**
- * Constructor for Page.
- *
- * @param title title of the page
- * @param icon icon for the page
- * @param menuLinkClass the category to which this page belongs
- * @param prefixPath prefix path that appears in the URL for this page
- */
- Page(final String title,
- final String icon,
- final String menuLinkClass,
- final String prefixPath) {
- this(title, null, icon, true, true, menuLinkClass, prefixPath);
- }
-
- /**
- * Constructor for Page.
- *
- * @param title title of the page
- * @param icon icon for the page
- * @param menuLinkClass the category to which this page belongs
- */
- Page(final String title,
- final String icon,
- final String menuLinkClass) {
- this(title, null, icon, true, true, menuLinkClass, null);
- }
-
- /**
- * Constructor for Page.
- *
- * @param title title of the page
- * @param icon icon for the page
- */
- Page(final String title,
- final String icon) {
- this(title, null, icon, true, true, null, null);
- }
-
- /**
- * Returns the title of the page.
- *
- * @return the title of the page.
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * Returns the subtitle of the page.
- *
- * @return the subtitle of the page.
- */
- public String getSubtitle() {
- return subtitle;
- }
-
- /**
- * Returns the base filename of the icon for page. E.g. "ic_my_icon", which will be appended
- * with appropriate size string (_24dp/_48dp) and file extension (.png) when used.
- *
- * @return the base filename of the icon for page.
- */
- public String getIcon() {
- return icon;
- }
-
- /**
- * Returns true if the page should be displayed in the navigation menu.
- *
- * @return true if the page should be displayed in the navigation menu.
- */
- public boolean getInMenu() {
- return inMenu;
- }
-
- /**
- * Returns the css class to add to the menu link to display it appropriately. E.g. "first" if
- * the link is the first in a group to separate it visually from the previous group.
- *
- * @return he class to add to the menu link to display it appropriately.
- */
- public String getMenuLinkClass() {
- return menuLinkClass;
- }
-
- /**
- * Returns true if the page should display the navigation menu.
- *
- * @return true if the page should display the navigation menu.
- */
- public boolean getHasMenu() {
- return hasMenu;
- }
-
- /**
- * Return the page's view name.
- *
- * @return the page's view name
- */
- public String getViewName() {
- return viewName;
- }
-
- /**
- * Return the page's view name.
- *
- * @return the page's view name
- */
- public String getPrefixPath() {
- return prefixPath;
- }
-
-}
-
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/package-info.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/package-info.java
deleted file mode 100644
index 8fc690b2..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/enums/package-info.java
+++ /dev/null
@@ -1 +0,0 @@
-package hirs.attestationca.portal.persist.enums;
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DbServiceImpl.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DbServiceImpl.java
deleted file mode 100644
index a58053cc..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DbServiceImpl.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package hirs.attestationca.portal.persist.service;
-
-public class DbServiceImpl {
- /**
- * The default maximum number of retries to attempt a database transaction.
- */
- public static final int DEFAULT_MAX_RETRY_ATTEMPTS = 10;
- /*
- * The default number of milliseconds to wait before retrying a database transaction.
- */
- private static final long DEFAULT_RETRY_WAIT_TIME_MS = 3000;
-
- // structure for retrying methods in the database
-// private RetryTemplate retryTemplate;
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DefaultService.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DefaultService.java
deleted file mode 100644
index c1d4ff01..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DefaultService.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package hirs.attestationca.portal.persist.service;
-
-public interface DefaultService {
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DeviceServiceImpl.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DeviceServiceImpl.java
deleted file mode 100644
index 5d87eeda..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/service/DeviceServiceImpl.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package hirs.attestationca.portal.persist.service;
-
-import hirs.attestationca.persist.entity.manager.DeviceRepository;
-import hirs.attestationca.persist.entity.userdefined.Device;
-import hirs.attestationca.persist.enums.AppraisalStatus;
-import hirs.attestationca.persist.enums.HealthStatus;
-import jakarta.persistence.EntityManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * https://github.com/darrachequesne/spring-data-jpa-datatables
- */
-@Service
-public class DeviceServiceImpl {
-
- @Autowired(required = false)
- private EntityManager entityManager;
- @Autowired
- private DeviceRepository deviceRepository;
-
- private static ListInetAddress
objects via
- * Hibernate. This class provides the mapping from InetAddress
to
- * Hibernate commands to JDBC.
- */
-@NoArgsConstructor(access = AccessLevel.PUBLIC)
-public final class InetAddressType implements UserType {
-
- /**
- * Returns varchar type.
- *
- * @return varchar type
- */
- @Override
- public int getSqlType() {
- return new StringJavaType.INSTANCE.sqlType();
- }
-
- /**
- * Returns the InetAddress
class.
- *
- * @return InetAddress
class
- */
- @Override
- public Class returnedClass() {
- return InetAddress.class;
- }
-
- /**
- * Compares x and y using {@link java.util.Objects#equals(Object, Object)}.
- *
- * @param x x
- * @param y y
- * @return value from equals call
- */
- @Override
- public boolean equals(final Object x, final Object y) {
- return Objects.equals(x, y);
- }
-
- /**
- * Returns the hash code of x, which will be the same as from
- * InetAddress
.
- *
- * @param x x
- * @return hash value of x
- */
- @Override
- public int hashCode(final Object x) {
- assert x != null;
- return x.hashCode();
- }
-
- /**
- * Converts the IP address that is stored as a String
and
- * converts it to an InetAddress
.
- *
- * @param rs
- * result set
- * @param names
- * column names
- * @param session
- * session
- * @param owner
- * owner
- * @return InetAddress of String
- * @throws HibernateException
- * if unable to convert the String to an InetAddress
- * @throws java.sql.SQLException
- * if unable to retrieve the String from the result set
- */
- @Override
- public Object nullSafeGet(final ResultSet rs, final String[] names,
- final SharedSessionContractImplementor session, final Object owner)
- throws HibernateException, SQLException {
-
- final String ip = StringJavaType.INSTANCE.getReplacement(rs.toString(), names[0],
- session);
- if (ip == null) {
- return null;
- }
- try {
- return InetAddress.getByName(ip);
- } catch (UnknownHostException e) {
- final String msg = String.format("unable to convert ip address: %s", ip);
- throw new HibernateException(msg, e);
- }
- }
-
- /**
- * Converts the InetAddress
value
to a
- * String
and stores it in the database.
- *
- * @param st prepared statement
- * @param value InetAddress
- * @param index index
- * @param session session
- * @throws java.sql.SQLException if unable to set the value in the result set
- */
- @Override
- public void nullSafeSet(final PreparedStatement st, final Object value,
- final int index, final SharedSessionContractImplementor session)
- throws SQLException {
- if (value == null) {
- StringJavaType.INSTANCE.set(st, null, index, session);
- } else {
- final InetAddress address = (InetAddress) value;
- final String ip = address.getHostAddress();
- StringJavaType.INSTANCE.set(st, ip, index, session);
- }
- }
-
- /**
- * Returns value
since InetAddress
is immutable.
- *
- * @param value value
- * @return value
- * @throws HibernateException will never be thrown
- */
- @Override
- public Object deepCopy(final Object value) throws HibernateException {
- return value;
- }
-
- /**
- * Returns false because InetAddress
is immutable.
- *
- * @return false
- */
- @Override
- public boolean isMutable() {
- return false;
- }
-
- /**
- * Returns value
because InetAddress
is
- * immutable.
- *
- * @param value value
- * @return value
- */
- @Override
- public Serializable disassemble(final Object value) {
- return (Serializable) value;
- }
-
- /**
- * Returns cached
because InetAddress
is
- * immutable.
- *
- * @param cached cached
- * @param owner owner
- * @return cached
- */
- @Override
- public Object assemble(final Serializable cached, final Object owner) {
- return cached;
- }
-
- /**
- * Returns the original
because InetAddress
is
- * immutable.
- *
- * @param original original
- * @param target target
- * @param owner owner
- * @return original
- */
- @Override
- public Object replace(final Object original, final Object target,
- final Object owner) {
- return original;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/type/X509CertificateType.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/type/X509CertificateType.java
deleted file mode 100644
index 58f4e836..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/persist/type/X509CertificateType.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package hirs.attestationca.portal.persist.type;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.hibernate.HibernateException;
-import org.hibernate.engine.spi.SharedSessionContractImplementor;
-import org.hibernate.usertype.UserType;
-
-import javax.sql.rowset.serial.SerialBlob;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.sql.Blob;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Objects;
-
-/**
- * This is a class for persisting X509Certificate
objects via
- * Hibernate. This class provides the mapping from X509Certificate
- * to Hibernate commands to JDBC.
- */
-@NoArgsConstructor(access= AccessLevel.PUBLIC)
-public final class X509CertificateType implements UserType {
-
- @Override
- public int getSqlType() {
- return Types.BLOB;
- }
-
- /**
- * Returns the X509Certificate
class.
- *
- * @return X509Certificate
class
- */
- @Override
- public Class returnedClass() {
- return X509Certificate.class;
- }
-
- /**
- * Compares x and y using {@link java.util.Objects#equals(Object, Object)}.
- *
- * @param x x
- * @param y y
- * @return value from equals call
- */
- @Override
- public boolean equals(final Object x, final Object y) {
- return Objects.equals(x, y);
- }
-
- /**
- * Returns the hash code of x, which will be the same as from
- * X509Certificate
.
- *
- * @param x x
- * @return hash value of x
- */
- @Override
- public int hashCode(final Object x) {
- assert x != null;
- return x.hashCode();
- }
-
- /**
- * Converts the X509Certificate that is stored as a String
and
- * converts it to an X509Certificate
.
- *
- * @param rs
- * result set
- * @param names
- * column names
- * @param session
- * session
- * @param owner
- * owner
- * @return X509Certificate of String
- * @throws HibernateException
- * if unable to convert the String to an X509Certificate
- * @throws java.sql.SQLException
- * if unable to retrieve the String from the result set
- */
- @Override
- public Object nullSafeGet(final ResultSet rs, final int names,
- final SharedSessionContractImplementor session, final Object owner)
- throws HibernateException, SQLException {
- final Blob cert = rs.getBlob(names);
- if (cert == null) {
- return null;
- }
- try {
- InputStream inputStream = new ByteArrayInputStream(
- cert.getBytes(1, (int) cert.length()));
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- return cf.generateCertificate(inputStream);
- } catch (CertificateException e) {
- final String msg = String.format(
- "unable to convert certificate: %s", cert);
- throw new HibernateException(msg, e);
- }
- }
-
- /**
- * Converts the X509Certificate
value
to a
- * String
and stores it in the database.
- *
- * @param st prepared statement
- * @param value X509Certificate
- * @param index index
- * @param session session
- * @throws java.sql.SQLException if unable to set the value in the result set
- */
- @Override
- public void nullSafeSet(final PreparedStatement st, final Object value,
- final int index, final SharedSessionContractImplementor session)
- throws SQLException {
- if (value == null) {
- st.setString(index, null);
- } else {
- try {
- Blob blob =
- new SerialBlob(((Certificate) value).getEncoded());
- st.setBlob(index, blob);
- } catch (Exception e) {
- final String msg =
- String.format("unable to convert certificate: %s",
- value.toString());
- throw new HibernateException(msg, e);
- }
- }
-
- }
-
- /**
- * Returns value
since X509Certificate
is
- * immutable.
- *
- * @param value value
- * @return value
- * @throws HibernateException will never be thrown
- */
- @Override
- public Object deepCopy(final Object value) throws HibernateException {
- return value;
- }
-
- /**
- * Returns false because X509Certificate
is immutable.
- *
- * @return false
- */
- @Override
- public boolean isMutable() {
- return false;
- }
-
- /**
- * Returns value
because X509Certificate
is
- * immutable.
- *
- * @param value value
- * @return value
- */
- @Override
- public Serializable disassemble(final Object value) {
- return (Serializable) value;
- }
-
- /**
- * Returns cached
because X509Certificate
is
- * immutable.
- *
- * @param cached cached
- * @param owner owner
- * @return cached
- */
- @Override
- public Object assemble(final Serializable cached, final Object owner) {
- return cached;
- }
-
- /**
- * Returns the original
because X509Certificate
is
- * immutable.
- *
- * @param original original
- * @param target target
- * @param owner owner
- * @return original
- */
- @Override
- public Object replace(final Object original, final Object target,
- final Object owner) {
- return original;
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSApplication.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSApplication.java
deleted file mode 100644
index 6a5e5c18..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSApplication.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package hirs.attestationca.portal.portal;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-import org.springframework.context.annotation.ComponentScan;
-
-import java.util.Collections;
-
-@SpringBootApplication
-@EnableAutoConfiguration
-@ComponentScan({"hirs.attestationca.portal", "hirs.attestationca.portal.page.controllers", "hirs.attestationca.persist.entity", "hirs.attestationca.persist.entity.service"})
-public class HIRSApplication extends SpringBootServletInitializer {
-
- @Override
- protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
- return application.sources(HIRSApplication.class);
- }
-
- public static void main(String[] args) {
- SpringApplication springApplication = new SpringApplication(HIRSApplication.class);
- springApplication.setDefaultProperties(Collections.singletonMap("server.servlet.context-path", "/portal"));
- springApplication.run(args);
-// SpringApplication.run(HIRSApplication.class, args);
- }
-}
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSDbInitializer.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSDbInitializer.java
deleted file mode 100644
index f69aea33..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/HIRSDbInitializer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package hirs.attestationca.portal.portal;
-
-import hirs.attestationca.persist.service.SettingsServiceImpl;
-import jakarta.servlet.ServletContextListener;
-import jakarta.servlet.annotation.WebListener;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-
-@WebListener
-public class HIRSDbInitializer implements ServletContextListener {
-
- private static final Logger LOGGER = LogManager.getLogger(HIRSDbInitializer.class);
-
- @Autowired
- AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
- @Autowired
- static SettingsServiceImpl settingsService = new SettingsServiceImpl();
-//
-// public void contextInitialized(final ServletContextEvent servletContextEvent) {
-//// AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
-// context.getEnvironment().addActiveProfile("server");
-// context.register(PersistenceJPAConfig.class);
-// context.refresh();
-//
-// // obtain reference to hibernate session factory
-// EntityManager entityManager = context.getBean(EntityManagerFactory.class)
-// .createEntityManager();
-// /**
-// * This fails if there is an entry already.
-// */
-//// entityManager.getTransaction().begin();
-//// entityManager.persist(context.getBean("default-settings"));
-//// entityManager.getTransaction().commit();
-//
-// insertDefaultEntries();
-// }
-//
-// /**
-// * Insert the ACA's default entries into the DB. This class is invoked after successful
-// * install of the HIRS_AttestationCA RPM.
-// *
-// */
-// public static synchronized void insertDefaultEntries() {
-// LOGGER.error("Ensuring default ACA database entries are present.");
-//
-// // If the SupplyChainAppraiser exists, do not attempt to re-save the supply chain appraiser
-// // or SupplyChainSettings
-//
-// // Create the SupplyChainAppraiser
-// LOGGER.error("Saving supply chain appraiser...");
-//
-//
-// // Create the SupplyChainSettings
-// LOGGER.error("Saving default supply chain policy...");
-//// SupplyChainSettings supplyChainPolicy = new SupplyChainSettings(
-//// SupplyChainSettings.DEFAULT_POLICY);
-// settingsService.saveSettings(new SupplyChainSettings("Default", "Settings are configured for no validation flags set."));
-//
-// LOGGER.error("ACA database initialization complete.");
-// }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/PersistenceJPAConfig.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/PersistenceJPAConfig.java
deleted file mode 100644
index 9766d2f2..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/PersistenceJPAConfig.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package hirs.attestationca.portal.portal;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.core.env.Environment;
-import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.jdbc.datasource.DriverManagerDataSource;
-import org.springframework.orm.jpa.JpaTransactionManager;
-import org.springframework.orm.jpa.JpaVendorAdapter;
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
-import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-import javax.sql.DataSource;
-import java.util.Properties;
-
-@Configuration
-@EnableTransactionManagement
-@PropertySource({ "classpath:hibernate.properties" })
-@ComponentScan({ "hirs.attestationca.portal.page" })
-@EnableJpaRepositories(basePackages = "hirs.attestationca.persist")
-public class PersistenceJPAConfig {
-
- @Autowired
- private Environment environment;
-
- @Bean
- public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
- final LocalContainerEntityManagerFactoryBean entityManagerBean = new LocalContainerEntityManagerFactoryBean();
- entityManagerBean.setDataSource(dataSource());
- entityManagerBean.setPackagesToScan(new String[] {"hirs.attestationca.persist"});
-
- JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
- entityManagerBean.setJpaVendorAdapter(vendorAdapter);
- entityManagerBean.setJpaProperties(additionalProperties());
-
- return entityManagerBean;
- }
-
- @Bean
- public DataSource dataSource() {
- final DriverManagerDataSource dataSource = new DriverManagerDataSource();
- dataSource.setDriverClassName(environment.getProperty("hibernate.connection.driver_class"));
- dataSource.setUrl(environment.getProperty("hibernate.connection.url"));
- dataSource.setUsername(environment.getProperty("hibernate.connection.username"));
- dataSource.setPassword(environment.getProperty("hibernate.connection.password"));
-
- return dataSource;
- }
-
- @Bean
- public PlatformTransactionManager transactionManager() {
- final JpaTransactionManager transactionManager = new JpaTransactionManager();
- transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
- return transactionManager;
- }
-
- @Bean
- public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
- return new PersistenceExceptionTranslationPostProcessor();
- }
-
- final Properties additionalProperties() {
- final Properties hibernateProperties = new Properties();
- hibernateProperties.setProperty("hibernate.hbm2ddl.auto",
- environment.getProperty("hibernate.hbm2ddl.auto"));
- hibernateProperties.setProperty("hibernate.dialect",
- environment.getProperty("hibernate.dialect"));
- hibernateProperties.setProperty("hibernate.cache.use_second_level_cache",
- "false");
-
- return hibernateProperties;
- }
-//
-// @Bean(name="default-settings")
-// public SupplyChainSettings supplyChainSettings() {
-// SupplyChainSettings scSettings = new SupplyChainSettings("Default", "Settings are configured for no validation flags set.");
-//
-// return scSettings;
-// }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/datatables/DataTableResponse.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/datatables/DataTableResponse.java
deleted file mode 100644
index fcce53b1..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/portal/datatables/DataTableResponse.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package hirs.attestationca.portal.portal.datatables;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * A Wrapper for Data Table JSON responses. Allows Spring to serialize a data object with additional
- * meta data required by data tables.
- *
- * @param DigestAlgorithm
that identifies which hash
- * function generated the digest.
- *
- * @return digest algorithm
- */
- public abstract DigestAlgorithm getAlgorithm();
-
- /**
- * Retrieves the digest.
- *
- * @return digest
- */
- public abstract byte[] getDigest();
-
- /**
- * Returns a hex String
representing the binary digest.
- *
- * @return hex representation of digest
- */
- public String getDigestString() {
- return Hex.encodeHexString(getDigest());
- }
-
- /**
- * Compares this digest's hash with another digest's hash.
- * @param otherDigest a Digest to compare to.
- * @return the comparison result type.
- */
- public DigestComparisonResultType compare(final Digest otherDigest) {
- if (null == otherDigest) {
- return DigestComparisonResultType.UNKNOWN;
- }
-
- if (this.equals(otherDigest)) {
- return DigestComparisonResultType.MATCH;
- }
-
- return DigestComparisonResultType.MISMATCH;
- }
-
- /**
- * Parses a {@link hirs.attestationca.portal.utils.digest.DigestAlgorithm} from a String returned by {@link hirs.attestationca.portal.utils.digest.AbstractDigest#toString()}.
- *
- * @param digest the digest string as computed above
- * @return the DigestAlgorithm component of the String
- */
- static DigestAlgorithm algorithmFromString(final String digest) {
- return DigestAlgorithm.findByString(matchString(digest).group(1));
- }
-
- /**
- * Parses a digest from a String returned by {@link hirs.attestationca.portal.utils.digest.AbstractDigest#toString()}.
- *
- * @param digest the digest string as computed above
- * @return the byte array representing the actual digest
- */
- static byte[] digestFromString(final String digest) {
- return DatatypeConverter.parseHexBinary(matchString(digest).group(2));
- }
-
- private static Matcher matchString(final String digest) {
- Pattern digestPattern = Pattern.compile("(.*) - 0x(.*)");
- Matcher matcher = digestPattern.matcher(digest);
- if (!matcher.matches()) {
- String message = String.format("String \"%s\" did not match pattern \"%s\"", digest,
- digestPattern.toString());
- throw new IllegalArgumentException(message);
- }
- return matcher;
- }
-
- @Override
- public final int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + getAlgorithm().hashCode();
- result = prime * result + Arrays.hashCode(getDigest());
- return result;
- }
-
- @Override
- public final boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null || !(obj instanceof AbstractDigest)) {
- return false;
- }
-
- AbstractDigest other = (AbstractDigest) obj;
-
- if (getAlgorithm() != other.getAlgorithm()) {
- return false;
- }
-
- if (!Arrays.equals(getDigest(), other.getDigest())) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns the standard algorithm name and a hexadecimal representation of
- * the bytes.
- *
- * @return string representation
- */
- @Override
- public String toString() {
- //NOTE: Any updates here should also be reflected in fromString()
- return String.format("%s - 0x%s", getAlgorithm().getStandardAlgorithmName(),
- Hex.encodeHexString(getDigest()));
- }
-
- private static final class IllegalDigestLength extends
- IllegalArgumentException {
-
- private static final long serialVersionUID = 8782184397041237374L;
-
- private IllegalDigestLength(final DigestAlgorithm algorithm,
- final byte[] digest) {
- super(String.format(
- "digest length (%d) does not match that of algorithm (%s)",
- digest.length, algorithm.toString()));
- }
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/Digest.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/Digest.java
deleted file mode 100644
index 51d31e6d..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/Digest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package hirs.attestationca.portal.utils.digest;
-
-import jakarta.persistence.Access;
-import jakarta.persistence.AccessType;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.persistence.EnumType;
-import jakarta.persistence.Enumerated;
-import jakarta.xml.bind.annotation.XmlElement;
-import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.binary.Hex;
-
-import java.util.Arrays;
-
-/**
- * This class represents a message digest. This stores the bytes of a message
- * digest as computed by a hash function.
- * MessageDigest
class by the
- * fact that it does not compute a digest. This class simply stores the result
- * of a digest. This is useful for scenarios where the digest is already known.
- * This is the case for IMA reports that already have the digest computed. The
- * MessageDigest
class does not provide a means to store that value.
- * The value must be computed.
- */
-@Embeddable
-@Access(AccessType.FIELD)
-public final class Digest extends AbstractDigest {
- /**
- * A SHA1 digest whose content is all zeros.
- */
- public static final Digest SHA1_ZERO = new Digest(
- DigestAlgorithm.SHA1,
- new byte[SHA1_DIGEST_LENGTH]
- );
-
- private static final String SHA1_EMPTY_HEX =
- "da39a3ee5e6b4b0d3255bfef95601890afd80709";
-
- /**
- * A SHA1 digest whose content is the hash of an empty buffer.
- */
- public static final Digest SHA1_OF_NO_DATA;
-
- static {
- try {
- SHA1_OF_NO_DATA = new Digest(
- DigestAlgorithm.SHA1,
- Hex.decodeHex(SHA1_EMPTY_HEX.toCharArray())
- );
- } catch (DecoderException e) {
- throw new RuntimeException("Could not decode hex value", e);
- }
- }
-
- @XmlElement
- @Column(nullable = false, name = "digest", length = SHA512_DIGEST_LENGTH,
- columnDefinition = "varbinary(64)")
- private final byte[] digest;
-
- @XmlElement
- @Column(nullable = false)
- @Enumerated(EnumType.ORDINAL)
- private final DigestAlgorithm algorithm;
-
- /**
- * Creates a new Digest
.
- *
- * @param algorithm algorithm used to generate the digest
- * @param digest digest value
- * @throws IllegalArgumentException if digest length does not match that of the algorithm
- */
- public Digest(final DigestAlgorithm algorithm, final byte[] digest)
- throws IllegalArgumentException {
- validateInput(algorithm, digest);
- this.algorithm = algorithm;
- this.digest = Arrays.copyOf(digest, digest.length);
- }
-
- /**
- * Creates a new Digest
when an algorithm isn't specified.
- * @param digest byte array value
- */
- public Digest(final byte[] digest) {
- this(AbstractDigest.getDigestAlgorithm(digest), digest);
- }
-
- /**
- * Default constructor necessary for Hibernate.
- */
- protected Digest() {
- this.algorithm = null;
- this.digest = null;
- }
-
- /**
- * Retrieves the DigestAlgorithm
that identifies which hash
- * function generated the digest.
- *
- * @return digest algorithm
- */
- @Override
- public DigestAlgorithm getAlgorithm() {
- return this.algorithm;
- }
-
- /**
- * Retrieves the digest.
- *
- * @return digest
- */
- @Override
- public byte[] getDigest() {
- return Arrays.copyOf(this.digest, this.digest.length);
- }
-
- /**
- * Returns a new Digest with the same attributes as this instance.
- *
- * @return a new equivalent Digest
- */
- public OptionalDigest asOptionalDigest() {
- return new OptionalDigest(algorithm, digest);
- }
-
- /**
- * Helper method to reverse the toString method. Returns a Digest given a String
- * that was created using an AbstractDigest's toString method.
- *
- * @param digest String representation of an AbstractDigest
- * @return Digest object recreated from the String passed in
- */
- public static Digest fromString(final String digest) {
- return new Digest(algorithmFromString(digest), digestFromString(digest));
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestAlgorithm.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestAlgorithm.java
deleted file mode 100644
index bae0307a..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestAlgorithm.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package hirs.attestationca.portal.utils.digest;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * Enum of digest algorithms. The enum values also provide a standardized
- * algorithm name. The standardized algorithm name is a String of the algorithm
- * name as defined by Java.
- */
-@Getter
-@AllArgsConstructor
-public enum DigestAlgorithm {
- /**
- * MD2 digest algorithm.
- */
- MD2("MD2", AbstractDigest.MD2_DIGEST_LENGTH),
- /**
- * MD5 digest algorithm.
- */
- MD5("MD5", AbstractDigest.MD5_DIGEST_LENGTH),
- /**
- * SHA-1 digest algorithm.
- */
- SHA1("SHA-1", AbstractDigest.SHA1_DIGEST_LENGTH),
- /**
- * SHA-256 digest algorithm.
- */
- SHA256("SHA-256", AbstractDigest.SHA256_DIGEST_LENGTH),
- /**
- * SHA-384 digest algorithm.
- */
- SHA384("SHA-384", AbstractDigest.SHA384_DIGEST_LENGTH),
- /**
- * SHA-512 digest algorithm.
- */
- SHA512("SHA-512", AbstractDigest.SHA512_DIGEST_LENGTH),
- /**
- * Condition used when an algorithm is not specified and
- * the size doesn't match known digests.
- */
- UNSPECIFIED("NOT SPECIFIED", Integer.BYTES);
-
- private final String standardAlgorithmName;
- private final int lengthInBytes;
-
- /**
- * Returns a DigestAlgorithm object given a String. The String is expected to be one of the
- * options for standardAlgorithmName. Throws an IllegalArgumentException if no Enum exists with
- * that value.
- *
- * @param standardAlgorithmName
- * String value of the Enum
- * @return DigestAlgorithm object
- */
- public static DigestAlgorithm findByString(final String standardAlgorithmName) {
- for (DigestAlgorithm algorithm: DigestAlgorithm.values()) {
- if (algorithm.getStandardAlgorithmName().equals(standardAlgorithmName)) {
- return algorithm;
- }
- }
- throw new IllegalArgumentException(String.format("No constant with text \"%s\" found",
- standardAlgorithmName));
- }
-}
\ No newline at end of file
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestComparisonResultType.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestComparisonResultType.java
deleted file mode 100644
index bd2425aa..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/DigestComparisonResultType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package hirs.attestationca.portal.utils.digest;
-
-/**
- * Enumeration identifying the different outcomes of a comparison between
- * two {@link hirs.attestationca.portal.utils.digest.Digest} objects.
- *
- */
-public enum DigestComparisonResultType {
- /**
- * When one of the Digests compared has a hash that is uninitialized, defaulted, or
- * is a byte array equal to zero.
- */
- UNKNOWN,
-
- /**
- * When the two digest hashes are equal, and are not zeroized / defaulted hash arrays.
- */
- MATCH,
-
- /**
- * When the two digest hashes are not equal, and are not zeroized / defaulted hash arrays.
- */
- MISMATCH,
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/OptionalDigest.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/OptionalDigest.java
deleted file mode 100644
index e24b0e04..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/digest/OptionalDigest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package hirs.attestationca.portal.utils.digest;
-
-import jakarta.persistence.Access;
-import jakarta.persistence.AccessType;
-import jakarta.persistence.Column;
-import jakarta.persistence.Embeddable;
-import jakarta.persistence.EnumType;
-import jakarta.persistence.Enumerated;
-import jakarta.xml.bind.annotation.XmlElement;
-
-import java.util.Arrays;
-
-/**
- * This class is identical to {@link hirs.attestationca.portal.utils.digest.Digest} except its fields are nullable. However, in practice,
- * an instance of this class cannot have null values assigned to its fields. The fields are marked
- * as nullable to allow Hibernate to set a reference an embedded instance of this class to null
- * (as there is no way for Hibernate to distinguish between a null reference and completely
- * null fields on an embedded entity.) Otherwise, there is no operational difference between
- * this class and {@link hirs.attestationca.portal.utils.digest.Digest}.
- */
-@Embeddable
-@Access(AccessType.FIELD)
-public final class OptionalDigest extends AbstractDigest {
- @XmlElement
- @Column(nullable = true, name = "digest", length = SHA512_DIGEST_LENGTH,
- columnDefinition = "varbinary(64)")
- private final byte[] digest;
-
- @XmlElement
- @Column(nullable = true)
- @Enumerated(EnumType.ORDINAL)
- private final DigestAlgorithm algorithm;
-
- /**
- * Creates a new OptionalDigest
.
- *
- * @param algorithm algorithm used to generate the digest
- * @param digest digest value
- * @throws IllegalArgumentException if digest length does not match that of the algorithm
- */
- public OptionalDigest(final DigestAlgorithm algorithm, final byte[] digest)
- throws IllegalArgumentException {
- validateInput(algorithm, digest);
- this.algorithm = algorithm;
- this.digest = Arrays.copyOf(digest, digest.length);
- }
-
- /**
- * Default constructor necessary for Hibernate.
- */
- protected OptionalDigest() {
- this.algorithm = null;
- this.digest = null;
- }
-
- /**
- * Returns the DigestAlgorithm
that identifies which hash
- * function generated the digest.
- *
- * @return digest algorithm
- */
- @Override
- public DigestAlgorithm getAlgorithm() {
- return algorithm;
- }
-
- /**
- * Returns the digest.
- *
- * @return digest
- */
- @Override
- public byte[] getDigest() {
- return Arrays.copyOf(this.digest, this.digest.length);
- }
-
- /**
- * Returns a new Digest with the same attributes as this instance.
- *
- * @return a new equivalent Digest
- */
- public Digest asDigest() {
- return new Digest(algorithm, digest);
- }
-
- /**
- * Helper method to reverse the toString method. Returns an OptionalDigest given a String
- * that was created using an AbstractDigest's toString method.
- *
- * @param digest String representation of an AbstractDigest
- * @return OptionalDigest object recreated from the String passed in
- */
- public static OptionalDigest fromString(final String digest) {
- return new OptionalDigest(algorithmFromString(digest), digestFromString(digest));
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/exception/PolicyManagerException.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/exception/PolicyManagerException.java
deleted file mode 100644
index c8e19f5c..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/exception/PolicyManagerException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package hirs.attestationca.portal.utils.exception;
-
-/**
- * This class represents an Exception
generated by a
- * PolicyManageer
.
- */
-public class PolicyManagerException extends RuntimeException {
-
- private static final long serialVersionUID = 3081536085161873284L;
-
- /**
- * Creates a new PolicyManagerException
that has the message
- * msg
.
- *
- * @param msg
- * exception message
- */
- public PolicyManagerException(final String msg) {
- super(msg);
- }
-
- /**
- * Creates a new PolicyManagerException
that wraps the given
- * Throwable
.
- *
- * @param t
- * root cause
- */
- public PolicyManagerException(final Throwable t) {
- super(t);
- }
-
- /**
- * Creates a new PolicyManagerException
that has the message
- * msg
and wraps the root cause.
- *
- * @param msg
- * exception message
- * @param t
- * root cause
- */
- public PolicyManagerException(final String msg, final Throwable t) {
- super(msg, t);
- }
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/TPMBaselineGeneratorException.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/TPMBaselineGeneratorException.java
deleted file mode 100644
index d86e7356..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/TPMBaselineGeneratorException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package hirs.attestationca.portal.utils.tpm;
-
-/**
- * This class represents an Exception
generated by
- * CreateTPMBaseline
.
- */
-public class TPMBaselineGeneratorException extends Exception {
-
- private static final long serialVersionUID = 8850867303391694668L;
-
- /**
- * Creates a new CreateTPMBaselineException
that has the
- * message msg
.
- *
- * @param msg
- * exception message
- */
- TPMBaselineGeneratorException(final String msg) {
- super(msg);
- }
-
- /**
- * Creates a new CreateTPMBaselineException
that wraps the
- * given Throwable
.
- *
- * @param t
- * root cause
- */
- TPMBaselineGeneratorException(final Throwable t) {
- super(t);
- }
-
- /**
- * Creates a new CreateTPMBaselineException
that has the
- * message msg
and wraps the root cause.
- *
- * @param msg
- * exception message
- * @param t
- * root cause
- */
- TPMBaselineGeneratorException(final String msg, final Throwable t) {
- super(msg, t);
- }
-
-}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TCGEventLog.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TCGEventLog.java
deleted file mode 100644
index 6ccb6cda..00000000
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/utils/tpm/eventlog/TCGEventLog.java
+++ /dev/null
@@ -1,350 +0,0 @@
-package hirs.attestationca.portal.utils.tpm.eventlog;
-
-import hirs.attestationca.utils.HexUtils;
-import hirs.attestationca.utils.digest.AbstractDigest;
-import hirs.attestationca.utils.tpm.eventlog.events.EvConstants;
-import hirs.attestationca.utils.tpm.eventlog.uefi.UefiConstants;
-import lombok.Getter;
-import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.binary.Hex;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.nio.charset.StandardCharsets;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-
-/**
- * Class for handling different formats of TCG Event logs.
- */
-public final class TCGEventLog {
-
- /** Logger. */
- private static final Logger LOGGER = LogManager.getLogger(TCGEventLog.class);
- /** Name of the hash algorithm used to process the Event Log, default is SHA256. */
- @Getter
- private String algorithm = "TPM_ALG_SHA256";
- /** Parsed event log array. */
- private static final int SIG_OFFSET = 32;
- /** TEV_NO_ACTION signature size. */
- private static final int SIG_SIZE = 16;
- /** Initial value for SHA 256 values.*/
- public static final String INIT_SHA256_LIST = "00000000000000000000000000"
- + "00000000000000000000000000000000000000";
- /** Initial value for SHA 256 values.*/
- public static final String LOCALITY4_SHA256_LIST = "ffffffffffffffffffffffffff"
- + "ffffffffffffffffffffffffffffffffffffff";
- /** Initial value for SHA 1 values. */
- public static final String INIT_SHA1_LIST = "0000000000000000000000000000000000000000";
- /** Initial value for SHA 1 values. */
- public static final String LOCALITY4_SHA1_LIST = "ffffffffffffffffffffffffffffffffffffffff";
- /** PFP defined EV_NO_ACTION identifier. */
- public static final int NO_ACTION_EVENT = 0x00000003;
- /** String value of SHA1 hash.*/
- public static final String HASH_STRING = "SHA1";
- /** String value of SHA256 hash. */
- public static final String HASH256_STRING = "SHA-256";
- /** Each PCR bank holds 24 registers. */
- public static final int PCR_COUNT = 24;
- /** Locality 4 starts at PCR 17. */
- public static final int PCR_LOCALITY4_MIN = 17;
- /** Locality 4 Ends at PCR 23. */
- public static final int PCR_LOCALITY4_MAX = 23;
- /** 2 dimensional array holding the PCR values. */
- private byte[][] pcrList;
- /** List of parsed events within the log. */
- private LinkedHashMap
- * <complexType name="BaseElement">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/>
- * <anyAttribute processContents='lax' namespace='##other'/>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "BaseElement", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
-@XmlSeeAlso({
- SoftwareIdentity.class,
- Entity.class,
- Link.class,
- Meta.class,
- ResourceCollection.class
-})
-public class BaseElement {
-
- @XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
- protected String lang;
- @XmlAnyAttribute
- private Map
- * <complexType name="CanonicalizationMethodType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <any maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "CanonicalizationMethodType", propOrder = {
- "content"
-})
-public class CanonicalizationMethodType {
-
- @XmlMixed
- @XmlAnyElement(lax = true)
- protected List