use of com.intel.mountwilson.as.helper.TrustAgentSecureClient in project OpenAttestation by OpenAttestation.
the class TAHelper method getQuoteInformationForHost.
// BUG #497 see the other getQuoteInformationForHost which is called from IntelHostAgent
// public HashMap<String, PcrManifest> getQuoteInformationForHost(String hostIpAddress, String pcrList, String name, int port) {
public HashMap<String, PcrManifest> getQuoteInformationForHost(TblHosts tblHosts, String pcrList) {
try {
// going to IntelHostAgent directly because 1) we are TAHelper so we know we need intel trust agents, 2) the HostAgent interface isn't ready yet for full generic usage, 3) one day this entire function will be in the IntelHostAgent or that agent will call THIS function instaed of the othe way around
HostAgentFactory factory = new HostAgentFactory();
TlsPolicy tlsPolicy = factory.getTlsPolicy(tblHosts.getTlsPolicyName(), tblHosts.getTlsKeystoreResource());
String connectionString = tblHosts.getAddOnConnectionInfo();
if (connectionString == null || connectionString.isEmpty()) {
if (tblHosts.getIPAddress() != null) {
// without vendor scheme because we are passing directly to TrustAgentSEcureClient (instead of to HOstAgentFactory)
connectionString = String.format("https://%s:%d", tblHosts.getIPAddress(), tblHosts.getPort());
}
} else if (connectionString.startsWith("intel:")) {
connectionString = connectionString.substring(6);
}
TrustAgentSecureClient client = new TrustAgentSecureClient(new TlsConnection(connectionString, tlsPolicy));
// IntelHostAgent agent = new IntelHostAgent(client, new InternetAddress(tblHosts.getIPAddress().toString()));
HashMap<String, PcrManifest> pcrMap = getQuoteInformationForHost(tblHosts.getIPAddress(), client, pcrList);
return pcrMap;
} catch (ASException e) {
throw e;
} catch (UnknownHostException e) {
throw new ASException(e, ErrorCode.AS_HOST_COMMUNICATION_ERROR, "Unknown host: " + (tblHosts.getIPAddress() == null ? "missing IP Address" : tblHosts.getIPAddress().toString()));
} catch (Exception e) {
throw new ASException(e);
}
}
Aggregations