2021-01-18 00:00:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <stdint.h>
|
2021-01-18 00:31:47 +00:00
|
|
|
#include <string>
|
2021-01-18 00:00:45 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace BareMinimumCrypto {
|
|
|
|
struct ExpiringSignature;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Structs and functions for the receiver role.
|
|
|
|
|
|
|
|
/*
|
|
|
|
The receiver needs to keep at least one root pubkey saved to
|
|
|
|
non-volatile memory. Since root keys are long-lived, you can
|
|
|
|
just compile them into the receiver app, too.
|
|
|
|
|
|
|
|
All the receiver does is receive combined cert-and-data messages,
|
|
|
|
and attempt to verify them. The subkeys used to directly sign the
|
2021-01-18 00:31:47 +00:00
|
|
|
data are disposable and not exposed to callers.
|
2021-01-18 00:00:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace BareMinimumCrypto::Receiver {
|
|
|
|
using namespace std;
|
|
|
|
|
2021-01-20 01:31:41 +00:00
|
|
|
typedef vector <uint8_t> Bytes;
|
|
|
|
|
|
|
|
optional <Bytes> verify_cert_and_data (
|
|
|
|
const Bytes & root_pubkey,
|
2021-01-18 00:00:45 +00:00
|
|
|
const ExpiringSignature & signed_cert,
|
2021-01-18 00:31:47 +00:00
|
|
|
const ExpiringSignature & signed_data
|
|
|
|
);
|
|
|
|
|
2021-01-20 01:31:41 +00:00
|
|
|
optional <Bytes> verify_cert_and_data (
|
|
|
|
const Bytes & root_pubkey,
|
|
|
|
const Bytes & msgpack
|
2021-01-18 00:00:45 +00:00
|
|
|
);
|
|
|
|
}
|