ptth/bare_minimum_crypto/cpp/sender.h

28 lines
601 B
C++

#pragma once
#include <optional>
#include <stdint.h>
#include <vector>
#include "expiring_signature.h"
#include "signing_key.h"
#include "time_helpers.h"
namespace BareMinimumCrypto {
using namespace std;
struct Sender {
static optional <Sender> create (SigningKey k, ExpiringSignature c);
// Signs data and attaches our cert from the CA
optional <Bytes> sign (const Bytes & data) const;
private:
SigningKey sender_key;
ExpiringSignature cert;
Bytes try_sign (const Bytes & data, Instant now) const;
optional <Bytes> sign (const Bytes & data, Instant now) const;
};
}