Search in sources :

Example 6 with IManifest

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;
}
Also used : PcrManifest(com.intel.mountwilson.manifest.data.PcrManifest) IManifest(com.intel.mountwilson.manifest.data.IManifest)

Example 7 with IManifest

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;
}
Also used : HashMap(java.util.HashMap) PcrManifest(com.intel.mountwilson.manifest.data.PcrManifest) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) IManifest(com.intel.mountwilson.manifest.data.IManifest)

Example 8 with IManifest

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");
}
Also used : HashMap(java.util.HashMap) PcrManifest(com.intel.mountwilson.manifest.data.PcrManifest) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) Matchers.anyString(org.mockito.Matchers.anyString) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) IManifest(com.intel.mountwilson.manifest.data.IManifest) Test(org.junit.Test)

Example 9 with IManifest

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");
}
Also used : HashMap(java.util.HashMap) PcrManifest(com.intel.mountwilson.manifest.data.PcrManifest) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) Matchers.anyString(org.mockito.Matchers.anyString) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) IManifest(com.intel.mountwilson.manifest.data.IManifest) Test(org.junit.Test)

Aggregations

IManifest (com.intel.mountwilson.manifest.data.IManifest)9 PcrManifest (com.intel.mountwilson.manifest.data.PcrManifest)8 TblPcrManifest (com.intel.mtwilson.as.data.TblPcrManifest)6 HashMap (java.util.HashMap)5 Matchers.anyString (org.mockito.Matchers.anyString)4 Test (org.junit.Test)3 ASException (com.intel.mountwilson.as.common.ASException)2 TblHosts (com.intel.mtwilson.as.data.TblHosts)2 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)2 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)2 IManifestStrategy (com.intel.mountwilson.manifest.IManifestStrategy)1 IManifestStrategyFactory (com.intel.mountwilson.manifest.IManifestStrategyFactory)1 TblTaLog (com.intel.mtwilson.as.data.TblTaLog)1 CryptographyException (com.intel.mtwilson.crypto.CryptographyException)1 HostTrustStatus (com.intel.mtwilson.datatypes.HostTrustStatus)1 Hostname (com.intel.mtwilson.util.net.Hostname)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1