From 2f733d1018c9602ecf8bac5e2516e69285120563 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sat, 26 Apr 2014 19:01:41 +0200 Subject: Add STH support, with failing tests due to gen_server testing woes. Move things out of spt() for reuse by sth(). --- src/plop.hrl | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/plop.hrl') diff --git a/src/plop.hrl b/src/plop.hrl index bfd900b..7275f5a 100644 --- a/src/plop.hrl +++ b/src/plop.hrl @@ -1,21 +1,29 @@ -%% A plop_entry has a type and some data. -%% A plop_data record has the meta data necessary for constructing a -%% signed timestamp. +-type signature_type() :: certificate_timestamp | tree_hash | test. +-type entry_type() :: x509 | precert | test. --record(plop_data, { +%% @doc The parts of an SPT which is to be signed. +-record(spt, { version = 1 :: integer(), - signature_type = certificate_timestamp :: certificate_timestamp | - tree_hash | - test, + signature_type :: signature_type(), timestamp = now :: 'now' | integer(), entry :: plop_entry() }). +-type spt() :: #spt{}. + -record(plop_entry, { - type = x509 :: x509 | precert | test, + type :: entry_type(), data = <<>> :: binary() }). - --type plop_data() :: #plop_data{}. -type plop_entry() :: #plop_entry{}. --export_type([plop_data/0, plop_entry/0]). +%% @doc The parts of an STH which is to be signed. +-record(sth, { + version = 1 :: integer(), + signature_type :: signature_type(), + timestamp = now :: 'now' | integer(), + tree_size :: integer(), + root_hash :: binary() % sha256 + }). +-type sth() :: #sth{}. + +-export_type([plop_entry/0, entry_type/0]). -- cgit v1.1