diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java index 0036e96d..13220698 100644 --- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java @@ -19,6 +19,8 @@ import hirs.persist.DBReferenceManifestManager; import hirs.persist.ReferenceDigestManager; import hirs.persist.ReferenceEventManager; import hirs.persist.ReferenceManifestManager; +import hirs.tpm.eventlog.TCGEventLog; +import hirs.tpm.eventlog.TpmPcrEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.hibernate.Criteria; @@ -32,9 +34,13 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; +import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Arrays; /** * Controller for the TPM Events page. @@ -177,6 +183,23 @@ public class RimDatabasePageController LOGGER.error("Failed to update TPM Event with Base RIM ID"); LOGGER.error(rdv); } + + //Find the matching TpmPcrEvent and decode the event content + try { + TCGEventLog logProcessor = new TCGEventLog(support.getRimBytes()); + for (TpmPcrEvent tpe : logProcessor.getEventList()) { + if (Arrays.equals(rdv.getContentBlob(), tpe.getEventContent())) { + rdv.setContentString(tpe.getEventContentStr()); + break; + } + } + } catch (NoSuchAlgorithmException e) { + LOGGER.info("Unknown algorithm encountered."); + } catch (CertificateException e) { + LOGGER.info("Log certificate could not be parsed."); + } catch (IOException e) { + LOGGER.info("Event could not be parsed."); + } } } } diff --git a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/rim-database.jsp b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/rim-database.jsp index 4df6377e..3a4d1827 100644 --- a/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/rim-database.jsp +++ b/HIRS_AttestationCAPortal/src/main/webapp/WEB-INF/jsp/rim-database.jsp @@ -15,6 +15,8 @@ <jsp:attribute name="pageHeaderTitle">RIM Database</jsp:attribute> <jsp:body> + <my:details-viewer id="content-blob-viewer" label="Event Content"> + </my:details-viewer> <br/> <div class="aca-data-table"> <table id="digestValueTable" class="display" width="100%"> @@ -25,7 +27,9 @@ <th>Event Type</th> <th>PCR Index</th> <th>Digest Value</th> + <th>Details</th> <th>Base RIM</th> + <th>Support RIM</th> </tr> </thead> </table> @@ -37,25 +41,35 @@ var columns = [ {data: 'manufacturer', orderable: true, - searchable:false}, + searchable: false}, {data: 'model', orderable: false, - searchable:false}, + searchable: false}, {data: 'eventType', orderable: false, - searchable:false,}, + searchable: false,}, {data: 'pcrIndex', orderable: true, - searchable:false}, + searchable: false}, {data: 'digestValue', orderable: false, - searchable:false}, + searchable: false}, + {data: 'contentString', + orderable: false, + searchable: false}, {data: 'baseRimId', orderable: false, searchable: false, render: function(data, type, full, meta) { return rimDetailsLink(full.baseRimId); } + }, + {data: 'supportRimId', + orderable: false, + searchable: false, + render: function(data, type, full, meta) { + return rimDetailsLink(full.supportRimId); + } } ]; diff --git a/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java b/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java index 7b25b38a..98a9b772 100644 --- a/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java +++ b/HIRS_Utils/src/main/java/hirs/data/persist/ReferenceDigestValue.java @@ -8,6 +8,7 @@ import javax.persistence.AccessType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; +import javax.persistence.Transient; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @@ -47,6 +48,8 @@ public class ReferenceDigestValue extends ArchivableEntity { private boolean matchFail; @Column(nullable = false) private boolean patched = false; + @Transient + private String contentString; //used for displaying content blob on frontend /** * Default constructor necessary for Hibernate. @@ -93,6 +96,7 @@ public class ReferenceDigestValue extends ArchivableEntity { this.matchFail = matchFail; this.patched = patched; this.contentBlob = Arrays.clone(contentBlob); + this.contentString = ""; } /** @@ -257,6 +261,22 @@ public class ReferenceDigestValue extends ArchivableEntity { } } + /** + * Getter for the String representation of the contentBlob property. + * @return the content string + */ + public String getContentString() { + return contentString; + } + + /** + * Setter for the String representation of the contentBlob property. + * @param contentString the string value + */ + public void setContentString(final String contentString) { + this.contentString = contentString; + } + @Override public boolean equals(final Object obj) { if (this == obj) {