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
75 lines
1.5 KiB
C++
75 lines
1.5 KiB
C++
#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>
|
|
#include <iostream>
|
|
|
|
#include "LogBase.h"
|
|
#include "UtilityFunctions.h"
|
|
|
|
using namespace std;
|
|
using namespace util;
|
|
|
|
enum IAS {
|
|
sigrl,
|
|
report
|
|
};
|
|
|
|
struct attestation_verification_report_t {
|
|
string report_id;
|
|
string isv_enclave_quote_status;
|
|
string timestamp;
|
|
};
|
|
|
|
struct attestation_evidence_payload_t {
|
|
string isv_enclave_quote;
|
|
};
|
|
|
|
struct ias_response_header_t {
|
|
int response_status;
|
|
int content_length;
|
|
std::string request_id;
|
|
};
|
|
|
|
struct ias_response_container_t {
|
|
char *p_response;
|
|
size_t size;
|
|
};
|
|
|
|
static int REQUEST_ID_MAX_LEN = 32;
|
|
static vector<pair<string, string>> retrieved_sigrl;
|
|
|
|
class WebService {
|
|
|
|
public:
|
|
static WebService* getInstance();
|
|
virtual ~WebService();
|
|
void init();
|
|
bool getSigRL(string gid, string *sigrl);
|
|
bool verifyQuote(uint8_t *quote, uint8_t *pseManifest, uint8_t *nonce, vector<pair<string, string>> *result);
|
|
|
|
private:
|
|
WebService();
|
|
bool sendToIAS(string url, IAS type, string payload,
|
|
struct curl_slist *headers,
|
|
ias_response_container_t *ias_response_container,
|
|
ias_response_header_t *response_header);
|
|
|
|
string createJSONforIAS(uint8_t *quote, uint8_t *pseManifest, uint8_t *nonce);
|
|
vector<pair<string, string>> parseJSONfromIAS(string json);
|
|
|
|
private:
|
|
static WebService* instance;
|
|
CURL *curl;
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|