]> WPIA git - cassiopeia.git/blob - src/database.h
add: Basic Unit Test setup using Boost UTF
[cassiopeia.git] / src / database.h
1 #pragma once
2
3 #include <string>
4 #include <memory>
5 #include <vector>
6
7 struct Profile {
8     std::string cert;
9     std::string key;
10 };
11
12 struct Job {
13     std::string id;
14     std::string target;
15     std::string task;
16     std::string from;
17     std::string to;
18 };
19
20 struct SAN {
21     std::string content;
22     std::string type;
23 };
24
25 struct AVA {
26     std::string name;
27     std::string value;
28 };
29
30 struct TBSCertificate {
31     std::string md;
32     std::string profile;
33     std::string csr;
34     std::string csr_type;
35     std::string csr_content;
36     std::vector<std::shared_ptr<SAN>> SANs;
37     std::vector<std::shared_ptr<AVA>> AVAs;
38 };
39
40
41 struct SignedCertificate {
42     std::string certificate;
43     std::string serial;
44     uint32_t before;
45     uint32_t after;
46     std::string pkHash;
47     std::string certHash;
48     std::string crt_name;
49 };
50
51 class JobProvider {
52 public:
53     virtual std::shared_ptr<Job> fetchJob() = 0;
54     virtual bool finishJob( std::shared_ptr<Job> job ) = 0;
55     virtual std::shared_ptr<TBSCertificate> fetchTBSCert( std::shared_ptr<Job> job ) = 0;
56     virtual void writeBack( std::shared_ptr<Job> job, std::shared_ptr<SignedCertificate> res ) = 0;
57 };