Updated RIM Details page to display File Not Found when the associated event log has not been uploaded with the swid tag.

This commit is contained in:
Cyrus 2020-06-25 08:47:51 -04:00
parent 62edecd929
commit e763461e46
3 changed files with 47 additions and 43 deletions

View File

@ -18,6 +18,7 @@ import java.security.cert.CertificateException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -157,7 +158,7 @@ public class ReferenceManifestDetailsPageController
data.put("rimType", rim.getRimType());
List<SwidResource> resources = rim.parseResource();
String resourceFilename = null;
TCGEventLog logProcessor = new TCGEventLog();
TCGEventLog logProcessor;
try {
for (SwidResource swidRes : resources) {
@ -171,8 +172,7 @@ public class ReferenceManifestDetailsPageController
swidRes.setPcrValues(Arrays.asList(
logProcessor.getExpectedPCRValues()));
} else {
swidRes.setPcrValues(Arrays.asList(
logProcessor.getExpectedPCRValues()));
swidRes.setPcrValues(new ArrayList<>());
}
}
} catch (NoSuchFileException nsfEx) {

View File

@ -127,46 +127,53 @@
<span data-toggle="tooltip" data-placement="top" title="Resource File">${resource.getName()}
</span>
</div>
<div class="component col col-md-10">
<span class="fieldHeader">File Size:</span>
<span class="fieldValue">${resource.getSize()}</span><br/>
<span class="fieldHeader">Hash:</span>
<span class="fieldValue" style="overflow-wrap: break-word">${resource.getHashValue()}</span><br/>
<c:if test="${not empty resource.getRimFormat()}">
<span class="fieldHeader">RIM Format:</span>
<span class="fieldValue">${resource.getRimFormat()}</span><br/>
</c:if>
<c:if test="${not empty resource.getRimType()}">
<span class="fieldHeader">RIM Type:</span>
<span class="fieldValue">${resource.getRimType()}</span><br/>
</c:if>
<c:if test="${not empty resource.getRimUriGlobal()}">
<span class="fieldHeader">URI Global:</span>
<span class="fieldValue">${resource.getRimUriGlobal()}</span><br/>
</c:if>
<c:if test="${not empty resource.getPcrValues()}">
<div class="panel-body">
<div class="component" role="tab" id="pcrValues">
<a role="button" data-toggle="collapse" data-parent="#directorycollapse" class="collapsed"
href="#pcrscollapse" aria-expanded="false" aria-controls="pcrscollapse">
Expected PCR Values
</a>
</div>
<div id="pcrscollapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree" aria-expanded="true">
<div>
<c:forEach items="${resource.getPcrMap()}" var="pcrValue">
<div id="componentIdentifier" class="row">
<div>
<span>${pcrValue.key}</span>
<span style="overflow-wrap: break-word">${pcrValue.value}</span>
</div>
<c:choose>
<c:when test="${not empty resource.getPcrValues()}">
<div class="component col col-md-10">
<span class="fieldHeader">File Size:</span>
<span class="fieldValue">${resource.getSize()}</span><br/>
<span class="fieldHeader">Hash:</span>
<span class="fieldValue" style="overflow-wrap: break-word">${resource.getHashValue()}</span><br/>
<c:if test="${not empty resource.getRimFormat()}">
<span class="fieldHeader">RIM Format:</span>
<span class="fieldValue">${resource.getRimFormat()}</span><br/>
</c:if>
<c:if test="${not empty resource.getRimType()}">
<span class="fieldHeader">RIM Type:</span>
<span class="fieldValue">${resource.getRimType()}</span><br/>
</c:if>
<c:if test="${not empty resource.getRimUriGlobal()}">
<span class="fieldHeader">URI Global:</span>
<span class="fieldValue">${resource.getRimUriGlobal()}</span><br/>
</c:if>
<c:if test="${not empty resource.getPcrValues()}">
<div class="panel-body">
<div class="component" role="tab" id="pcrValues">
<a role="button" data-toggle="collapse" data-parent="#directorycollapse" class="collapsed"
href="#pcrscollapse" aria-expanded="false" aria-controls="pcrscollapse">
Expected PCR Values
</a>
</div>
<div id="pcrscollapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree" aria-expanded="true">
<div>
<c:forEach items="${resource.getPcrMap()}" var="pcrValue">
<div id="componentIdentifier" class="row">
<div>
<span>${pcrValue.key}</span>
<span style="overflow-wrap: break-word">${pcrValue.value}</span>
</div>
</div>
</c:forEach>
</div>
</c:forEach>
</div>
</div>
</div>
</c:if>
</div>
</c:if>
</div>
</c:when>
<c:otherwise>
<div class="component col col-md-10" style="color: red; padding-left: 20px">File Not Found.</div>
</c:otherwise>
</c:choose>
</div>
</div>
</c:forEach>

View File

@ -213,9 +213,6 @@ public class SwidResource {
return innerMap;
}
/**
*
*/
private void parsePcrValues() {
TCGEventLog logProcessor = new TCGEventLog();