40 lines
754 B
C++
40 lines
754 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "json.hpp"
|
|
|
|
#include "time_helpers.h"
|
|
|
|
namespace BareMinimumCrypto {
|
|
using namespace std;
|
|
using nlohmann::json;
|
|
|
|
typedef vector <uint8_t> Bytes;
|
|
|
|
struct ExpiringSignature {
|
|
// Payload is contained in here
|
|
Bytes cert;
|
|
Bytes sig;
|
|
Bytes signer_pubkey;
|
|
|
|
bool operator == (const ExpiringSignature & o) const;
|
|
bool operator != (const ExpiringSignature & o) const;
|
|
|
|
Bytes to_msgpack () const;
|
|
};
|
|
|
|
struct KeyCertFile {
|
|
Bytes sig;
|
|
|
|
// The rest of the fields are inside a nested msgpack that gets signed
|
|
Bytes pubkey;
|
|
TimeRange valid_time;
|
|
|
|
Bytes to_msgpack () const;
|
|
static optional <KeyCertFile> try_from_msgpack (const json & msg);
|
|
};
|
|
}
|