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
|
%%% plop data structures. Heavily based on RFC 6962. Some are for
%%% database storage, some for interfacing with consumers and some are
%%% for serialisation.
-type signature_type() :: certificate_timestamp | tree_hash | test. % uint8
-type entry_type() :: x509 | precert | test. % uint16
-type leaf_type() :: timestamped_entry | test. % uint8
%% @doc Merkle Tree Leaf -- what's sent as 'leaf_input' in response to
%% get-entries requests and also the input to the hash function for
%% leaf hashes in the tree. RFC 6962 sect 3.4.
-record(mtl, {
version = 1 :: pos_integer(),
leaf_type = timestamped_entry :: leaf_type(),
entry :: timestamped_entry()
}).
-type mtl() :: #mtl{}.
-record(spt_on_wire, {
version :: pos_integer(), % uint8
logid :: binary(), % SHA-256 over DER encoded public log key
timestamp :: integer(), % uint64
signature :: binary()
}).
-type spt_on_wire() :: #spt_on_wire{}.
%% @doc What's signed in an SPT. Used for serialisation before hasning
%% and signing. FIXME: Overlapping #spt{} -- merge somehow.
-record(spt_signed, {
version :: pos_integer(),
signature_type :: signature_type(),
timestamp :: integer(),
entry_type :: entry_type(),
signed_entry :: binary()
}).
-type spt_signed() :: #spt_signed{}.
%% %% Part of interface to plop:add/1.
%% -record(plop_entry, {
%% type :: entry_type(),
%% data :: binary()
%% }).
%% -type plop_entry() :: #plop_entry{}.
%% A data entry.
-record(timestamped_entry, {
timestamp = now :: now | integer(),
entry_type :: entry_type(),
entry :: binary()
}).
-type timestamped_entry() :: #timestamped_entry{}.
%% @doc The parts of an STH which is to be signed. Used as the
%% interface to plop:sth/1, for testing. Should probably be internal
%% to plop, if that can be arranged wrt testing.
-record(sth, {
version = 1 :: pos_integer(),
signature_type :: signature_type(),
timestamp = now :: 'now' | integer(),
tree_size :: integer(),
root_hash :: binary() % SHA-256
}).
-type sth() :: #sth{}.
-export_type([timestamped_entry/0, mtl/0, entry_type/0]).
|