This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX_ITEMS 100 | |
#define MAX_ITEM_SIZE 100 | |
// item | |
struct Item { | |
char title[MAX_ITEM_SIZE]; | |
char username[MAX_ITEM_SIZE]; | |
char password[MAX_ITEM_SIZE]; | |
}; | |
typedef struct Item item_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char** argv) { | |
sgx_enclave_id_t eid = 0; | |
sgx_launch_token_t token = {0}; | |
int updated, ret; | |
sgx_status_t ecall_status, enclave_status; | |
enclave_status = sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL); | |
if(enclave_status != SGX_SUCCESS) { | |
error_print("Fail to initialize enclave."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Client::startConnection() { | |
Log("Start connecting..."); | |
boost::system::error_code ec; | |
boost::asio::connect(socket_.lowest_layer(), this->endpoint_iterator, ec); | |
handle_connect(ec); | |
} | |
void Client::handle_connect(const boost::system::error_code &error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void NetworkManagerClient::startService() { | |
this->client->startConnection(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void VerificationManager::start() { | |
this->nm->startService(); | |
Log("Remote attestation done"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<string> VerificationManager::incomingHandler(string v, int type) { | |
vector<string> res; | |
if (!v.empty()) { | |
string s; | |
bool ret; | |
switch (type) { | |
case RA_MSG0: { | |
Messages::MessageMsg0 msg0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int VerificationManager::init() { | |
if (this->sp) { | |
delete this->sp; | |
this->sp = new ServiceProvider(this->ws); | |
} | |
this->nm->Init(); | |
this->nm->connectCallbackHandler([this](string v, int type) { | |
return this->incomingHandler(v, type); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef WEBSERVICE_H | |
#define WEBSERVICE_H | |
#include <string> | |
#include <stdio.h> | |
#include <limits.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <curl/curl.h> | |
#include <jsoncpp/json/json.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef VERIFICATIONMANAGER_H | |
#define VERIFICATIONMANAGER_H | |
#include <string> | |
#include <stdio.h> | |
#include <limits.h> | |
#include <unistd.h> | |
#include "ServiceProvider.h" | |
#include "NetworkManagerClient.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <unistd.h> | |
#include "LogBase.h" | |
#include "NetworkManager.h" | |
#include "VerificationManager.h" | |
#include "UtilityFunctions.h" | |
using namespace util; |