]> WPIA git - cassiopeia.git/blob - src/database.h
71d44acbb82b29932d90e0059bbe504114c93c60
[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 TBSCertificate {
26     std::string CN;
27     std::string subj;
28     std::string md;
29     std::string profile;
30     std::string csr;
31     std::string csr_type;
32     std::string csr_content;
33     std::vector<std::shared_ptr<SAN>> SANs;
34 };
35
36 struct SignedCertificate {
37     std::string certificate;
38     uint32_t serial;
39     uint32_t before;
40     uint32_t after;
41     std::string pkHash;
42     std::string certHash;
43     std::string crt_name;
44 };
45
46 class JobProvider {
47 public:
48     virtual std::shared_ptr<Job> fetchJob() = 0;
49     virtual bool finishJob( std::shared_ptr<Job> job ) = 0;
50     virtual std::shared_ptr<TBSCertificate> fetchTBSCert( std::shared_ptr<Job> job ) = 0;
51     virtual void writeBack( std::shared_ptr<Job> job, std::shared_ptr<SignedCertificate> res ) = 0;
52 };