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