Systemsicherheit/Assignment 7 - SGX Hands-on/SGX101_sample_code-master/RemoteAttestation/MessageHandler/MessageHandler.h
Paul Zinselmeyer ba8e969470
All checks were successful
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (push) Successful in 1m2s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (push) Successful in 1m3s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (push) Successful in 1m0s
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (pull_request) Successful in 30s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (pull_request) Successful in 10s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (pull_request) Successful in 8s
[Assignment-7] add SGX sample code from VM
2024-06-29 17:55:44 +02:00

68 lines
1.4 KiB
C++

#ifndef MESSAGEHANDLER_H
#define MESSAGEHANDLER_H
#include <string>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include <iostream>
#include <iomanip>
#include "Enclave.h"
#include "NetworkManagerServer.h"
#include "Messages.pb.h"
#include "UtilityFunctions.h"
#include "remote_attestation_result.h"
#include "LogBase.h"
#include "../GeneralSettings.h"
using namespace std;
using namespace util;
class MessageHandler {
public:
MessageHandler(int port = Settings::rh_port);
virtual ~MessageHandler();
sgx_ra_msg3_t* getMSG3();
int init();
void start();
vector<string> incomingHandler(string v, int type);
private:
sgx_status_t initEnclave();
uint32_t getExtendedEPID_GID(uint32_t *extended_epid_group_id);
sgx_status_t getEnclaveStatus();
void assembleAttestationMSG(Messages::AttestationMessage msg, ra_samp_response_header_t **pp_att_msg);
string handleAttestationResult(Messages::AttestationMessage msg);
void assembleMSG2(Messages::MessageMSG2 msg, sgx_ra_msg2_t **pp_msg2);
string handleMSG2(Messages::MessageMSG2 msg);
string handleMSG0(Messages::MessageMsg0 msg);
string generateMSG1();
string handleVerification();
string generateMSG0();
string createInitMsg(int type, string msg);
protected:
Enclave *enclave = NULL;
private:
int busy_retry_time = 4;
NetworkManagerServer *nm = NULL;
};
#endif