use of com.intel.mountwilson.ta.host.data.HostRequestType in project OpenAttestation by OpenAttestation.
the class TrustAgentSecureClient method getHostAttributes.
public String getHostAttributes() {
try {
log.info("Sending Generate Identity");
byte[] identityInput = "<host_info_request></host_info_request>".getBytes();
this.data = identityInput;
HostRequestType response = sendHostRequest();
//ClientRequestType response = sendQuoteRequest();
String hardware_uuid = response.getHardware_uuid();
// TODO: ensure certificate is propertly formatted. If missing a line after the header, insert it. Or decode it, and re-encode as base-64 blob with no line endings.
return hardware_uuid;
//return certificate;
} catch (ASException ase) {
throw ase;
} catch (UnknownHostException e) {
throw new ASException(e, ErrorCode.AS_HOST_COMMUNICATION_ERROR, this.serverHostname);
} catch (Exception e) {
throw new ASException(e);
}
}
use of com.intel.mountwilson.ta.host.data.HostRequestType in project OpenAttestation by OpenAttestation.
the class TrustAgentSecureClient method sendHostRequest.
/**
*
* @return an object representing the RESPONSE from the Trust Agent
* @throws UnknownHostException if the IP address of the host could not be determined from local hosts file or DNS
* @throws IOException if there was an error connecting to the host, such as it is not reachable on the network or it dropped the connection
* @throws JAXBException when the response from the host cannot be interpreted properly
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
*/
public synchronized HostRequestType sendHostRequest() throws UnknownHostException, IOException, JAXBException, KeyManagementException, NoSuchAlgorithmException {
try {
byte[] buf = sendRequestWithSSLSocket();
log.info("Unmarshalling to Jaxb object.");
JAXBContext jc = JAXBContext.newInstance("com.intel.mountwilson.ta.host.data");
log.debug("Created JAXBContext Instance {}", jc.toString());
//assert jc != null; Expression always true
Unmarshaller u = jc.createUnmarshaller();
log.debug("Created Unmarshaller Instance {}", u.toString());
//assert new String(buf) != null; //Expresion always return null.
assert buf != null;
log.debug("Unmarshalling");
JAXBElement po = (JAXBElement) u.unmarshal(new StringReader(new String(buf).trim()));
log.debug("Unmarshalled");
assert po != null;
HostRequestType response = (HostRequestType) po.getValue();
assert response != null;
checkHostError(response);
log.info("Done reading/writing to/from socket, closing socket.");
return response;
} finally {
}
}
Aggregations