ptth/bare_minimum_crypto/cpp/expiring_signature.h

37 lines
699 B
C
Raw Normal View History

#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;
bool operator == (const ExpiringSignature & o) const;
bool operator != (const ExpiringSignature & o) 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);
};
}