use of com.intel.mountwilson.manifest.data.IManifest in project OpenAttestation by OpenAttestation.
the class HostTrustBO method verifyAssetTagTrust.
private boolean verifyAssetTagTrust(TblHosts host, TblMle mle, HashMap<String, ? extends IManifest> pcrManifestMap, MwAssetTagCertificate atagCert) {
String certSha1 = Sha1Digest.valueOf(atagCert.getPCREvent()).toString();
IManifest pcrMf = pcrManifestMap.get("22");
PcrManifest goodKnownValue = (PcrManifest) pcrManifestMap.get("22");
boolean trustStatus;
if (goodKnownValue != null) {
log.debug("Checking PCR 22: {} - {}", certSha1, goodKnownValue.getPcrValue());
trustStatus = certSha1.toUpperCase().equalsIgnoreCase(goodKnownValue.getPcrValue().toUpperCase());
} else {
log.debug("goodKnownValue is null");
trustStatus = false;
}
String pcr = "22";
log.info(String.format("PCR %s Host Trust status %s", pcr, String.valueOf(trustStatus)));
if (pcrMf != null)
logTrustStatus(host, mle, pcrMf);
else {
log.info("PCR Manifest is null, unable to log Trust Status");
}
return trustStatus;
}
use of com.intel.mountwilson.manifest.data.IManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategy method getPcrManifestMap.
private HashMap<String, ? extends IManifest> getPcrManifestMap(TblMle mle) {
HashMap<String, IManifest> pcrManifests = new HashMap<String, IManifest>();
for (TblPcrManifest pcrMf : mle.getTblPcrManifestCollection()) {
// Call query method to avoid the objects from the cache
pcrMf = getPcrManifestJpaController().findPcrManifestById(pcrMf.getId());
pcrManifests.put(pcrMf.getName().trim(), new PcrManifest(Integer.valueOf(pcrMf.getName()), pcrMf.getValue().trim()));
log.info("{} - {}", new Object[] { pcrMf.getName(), pcrMf.getValue() });
}
return pcrManifests;
}
use of com.intel.mountwilson.manifest.data.IManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategyTest method testGetBiosGoodKnownManifest.
@Test
public void testGetBiosGoodKnownManifest() {
when(mleJpaController.findBiosMle(anyString(), anyString(), anyString())).thenReturn(mockFindBiosMle());
TblPcrManifest pcr = new TblPcrManifest(1, "0", "31B97D97B4679917EC3C1D943635693FFBAB4143");
when(pcrManifestJpaController.findPcrManifestById(any(Integer.class))).thenReturn(pcr);
HashMap<String, IManifest> pcrManifests = (HashMap<String, IManifest>) gkvstrategy.getBiosGoodKnownManifest("DELL", "A08", "DELL");
assertNotNull(pcrManifests);
assertEquals(pcrManifests.size(), 1);
PcrManifest pcrMf = (PcrManifest) pcrManifests.get("0");
assertNotNull(pcrMf);
assertEquals(pcrMf.getPcrNumber(), 0);
assertEquals(pcrMf.getPcrValue(), "31B97D97B4679917EC3C1D943635693FFBAB4143");
}
use of com.intel.mountwilson.manifest.data.IManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategyTest method testGetVmmGoodKnownManifest.
@Test
public void testGetVmmGoodKnownManifest() {
when(mleJpaController.findVmmMle(anyString(), anyString(), anyString(), anyString())).thenReturn(mockFindVmmMle());
TblPcrManifest pcr = new TblPcrManifest(1, "18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
when(pcrManifestJpaController.findPcrManifestById(any(Integer.class))).thenReturn(pcr);
HashMap<String, IManifest> pcrManifests = (HashMap<String, IManifest>) gkvstrategy.getVmmGoodKnownManifest("XEN", "4.3", "Fedora", "20", 1);
assertNotNull(pcrManifests);
assertEquals(pcrManifests.size(), 1);
PcrManifest pcrMf = (PcrManifest) pcrManifests.get("18");
assertNotNull(pcrMf);
assertEquals(pcrMf.getPcrNumber(), 18);
assertEquals(pcrMf.getPcrValue(), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
}
Aggregations