-
Notifications
You must be signed in to change notification settings - Fork 3
/
OpenARC.hpp
79 lines (60 loc) · 1.47 KB
/
OpenARC.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef OPENARC_DOT_HPP_INCLUDED
#define OPENARC_DOT_HPP_INCLUDED
#include <cstring>
#include <string_view>
#include <vector>
// Forward to keep from including <openarc/arc.h>
struct arc_hdrfield;
struct arc_lib;
struct arc_msghandle;
namespace OpenARC {
class lib {
// no copy
lib(lib const&) = delete;
lib& operator=(lib const&) = delete;
public:
// move
lib(lib&&) = default;
lib& operator=(lib&&) = default;
void get_option(int arg, void* val = nullptr, size_t valsz = 0);
void set_option(int arg, void* val = nullptr, size_t valsz = 0);
void set_cv_unkn();
void set_cv_none();
void set_cv_fail();
void set_cv_pass();
void header(std::string_view header);
void eoh();
void body(std::string_view body);
void chunk(std::string_view chunk);
void eom();
protected:
lib();
~lib();
arc_lib* arc_ = nullptr;
arc_msghandle* msg_ = nullptr;
};
class sign : public lib {
public:
sign();
~sign();
bool seal(char const* authservid,
char const* selector,
char const* domain,
char const* key,
size_t keylen,
char const* ar);
std::string name() const;
std::string value() const;
std::vector<std::string> whole_seal() const;
private:
arc_hdrfield* seal_ = nullptr;
};
class verify : public lib {
public:
verify();
~verify();
char const* chain_status_str() const;
std::string chain_custody_str() const;
};
} // namespace OpenARC
#endif // OPENARC_DOT_HPP_INCLUDED