Clean up checkstyle warnings
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled

This commit is contained in:
chubtub 2024-12-11 10:04:10 -05:00
parent cb2ba1a846
commit 6af53fe497
3 changed files with 24 additions and 16 deletions

View File

@ -66,6 +66,13 @@ public class PcrValidator {
baselinePcrs = Arrays.copyOf(pcrValues, TPMMeasurementRecord.MAX_PCR_ID + 1); baselinePcrs = Arrays.copyOf(pcrValues, TPMMeasurementRecord.MAX_PCR_ID + 1);
} }
/**
* Builds a string array of stored pcrs.
*
* @param pcrContent string representation of the pcr content
* @param algorithmLength length of the algorithm
* @return string array representation of the stored pcrs.
*/
public static String[] buildStoredPcrs(final String pcrContent, final int algorithmLength) { public static String[] buildStoredPcrs(final String pcrContent, final int algorithmLength) {
// we have a full set of PCR values // we have a full set of PCR values
String[] pcrSet = pcrContent.split("\\n"); String[] pcrSet = pcrContent.split("\\n");
@ -244,9 +251,9 @@ public class PcrValidator {
// other information. // other information.
String calculatedString = Hex.encodeHexString( String calculatedString = Hex.encodeHexString(
pcrInfoShort.getCalculatedDigest()); pcrInfoShort.getCalculatedDigest());
log.debug("Validating PCR information with the following:" + log.debug("Validating PCR information with the following:"
System.lineSeparator() + "calculatedString = " + calculatedString + + System.lineSeparator() + "calculatedString = " + calculatedString
System.lineSeparator() + "quoteString = " + quoteString); + System.lineSeparator() + "quoteString = " + quoteString);
validated = quoteString.contains(calculatedString); validated = quoteString.contains(calculatedString);
if (!validated) { if (!validated) {
log.warn(calculatedString + " not found in " + quoteString); log.warn(calculatedString + " not found in " + quoteString);

View File

@ -97,11 +97,12 @@ public class ReferenceManifestDetailsPageController
* @throws NoSuchAlgorithmException If an unknown Algorithm is encountered. * @throws NoSuchAlgorithmException If an unknown Algorithm is encountered.
* @throws CertificateException if a certificate doesn't parse. * @throws CertificateException if a certificate doesn't parse.
*/ */
public static HashMap<String, Object> getRimDetailInfo(final UUID uuid, public static HashMap<String, Object> getRimDetailInfo(
final ReferenceManifestRepository referenceManifestRepository, final UUID uuid,
final ReferenceDigestValueRepository referenceDigestValueRepository, final ReferenceManifestRepository referenceManifestRepository,
final CertificateRepository certificateRepository, final ReferenceDigestValueRepository referenceDigestValueRepository,
final CACredentialRepository caCertificateRepository) final CertificateRepository certificateRepository,
final CACredentialRepository caCertificateRepository)
throws IOException, throws IOException,
CertificateException, NoSuchAlgorithmException { CertificateException, NoSuchAlgorithmException {
HashMap<String, Object> data = new HashMap<>(); HashMap<String, Object> data = new HashMap<>();
@ -297,7 +298,7 @@ public class ReferenceManifestDetailsPageController
* @return list of X509Certificates * @return list of X509Certificates
*/ */
private static List<X509Certificate> convertCACsToX509Certificates( private static List<X509Certificate> convertCACsToX509Certificates(
Set<CertificateAuthorityCredential> set) final Set<CertificateAuthorityCredential> set)
throws IOException { throws IOException {
ArrayList<X509Certificate> certs = new ArrayList<>(set.size()); ArrayList<X509Certificate> certs = new ArrayList<>(set.size());
for (CertificateAuthorityCredential cac : set) { for (CertificateAuthorityCredential cac : set) {

View File

@ -76,8 +76,9 @@ public class ReferenceManifestPageController extends PageController<NoPageParams
* @param referenceDigestValueRepository this is the reference event manager * @param referenceDigestValueRepository this is the reference event manager
*/ */
@Autowired @Autowired
public ReferenceManifestPageController(final ReferenceManifestRepository referenceManifestRepository, public ReferenceManifestPageController(
final ReferenceDigestValueRepository referenceDigestValueRepository) { final ReferenceManifestRepository referenceManifestRepository,
final ReferenceDigestValueRepository referenceDigestValueRepository) {
super(Page.REFERENCE_MANIFESTS); super(Page.REFERENCE_MANIFESTS);
this.referenceManifestRepository = referenceManifestRepository; this.referenceManifestRepository = referenceManifestRepository;
this.referenceDigestValueRepository = referenceDigestValueRepository; this.referenceDigestValueRepository = referenceDigestValueRepository;
@ -177,10 +178,10 @@ public class ReferenceManifestPageController extends PageController<NoPageParams
if (isBaseRim || isSupportRim) { if (isBaseRim || isSupportRim) {
parseRIM(file, isSupportRim, messages, baseRims, supportRims); parseRIM(file, isSupportRim, messages, baseRims, supportRims);
} else { } else {
String errorString = "The file extension of " + fileName + " was not recognized." + String errorString = "The file extension of " + fileName + " was not recognized."
" Base RIMs support the extension \".swidtag\", and support RIMs support " + + " Base RIMs support the extension \".swidtag\", and support RIMs support "
"\".rimpcr\", \".rimel\", \".bin\", and \".log\". " + + "\".rimpcr\", \".rimel\", \".bin\", and \".log\". "
"Please verify your upload and retry."; + "Please verify your upload and retry.";
log.error("File extension in " + fileName + " not recognized as base or support RIM."); log.error("File extension in " + fileName + " not recognized as base or support RIM.");
messages.addError(errorString); messages.addError(errorString);
} }
@ -380,7 +381,6 @@ public class ReferenceManifestPageController extends PageController<NoPageParams
* user. * user.
* @param baseRims object to store multiple files * @param baseRims object to store multiple files
* @param supportRims object to store multiple files * @param supportRims object to store multiple files
* @return a single or collection of reference manifest files.
*/ */
private void parseRIM( private void parseRIM(
final MultipartFile file, final boolean supportRIM, final MultipartFile file, final boolean supportRIM,