diff options
author | Magnus Ahltorp <map@kth.se> | 2015-04-06 03:14:58 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-04-06 03:14:58 +0200 |
commit | 3d7c2403f16d85222c52ca092f6732671d8af768 (patch) | |
tree | 8cb3d88e1c128c7ab5f9b0c043803ab7540714cf /src | |
parent | f8a36b4a27a976d56448a884b36b4ac2534f09f6 (diff) |
Verify that database entry actually contains the certificate
Diffstat (limited to 'src')
-rw-r--r-- | src/catlfish.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/catlfish.erl b/src/catlfish.erl index ed75495..d98e741 100644 --- a/src/catlfish.erl +++ b/src/catlfish.erl @@ -5,7 +5,7 @@ -export([add_chain/3, entries/2, entry_and_proof/2]). -export([known_roots/0, update_known_roots/0]). -export([init_cache_table/0]). --export([entryhash_from_entry/1]). +-export([entryhash_from_entry/1, chain_from_entry/1]). -include_lib("eunit/include/eunit.hrl"). -define(PROTOCOL_VERSION, 0). @@ -252,7 +252,7 @@ deserialise_extra_data(ExtraData) -> [E | deserialise_extra_data(Rest)] end. -entryhash_from_entry(Entry) -> +chain_from_entry(Entry) -> {MTLText, ExtraDataPacked} = unpack_entry(Entry), {ExtraData, <<>>} = decode_tls_vector(ExtraDataPacked, 3), MTL = deserialise_mtl(MTLText), @@ -266,7 +266,10 @@ entryhash_from_entry(Entry) -> precert_entry -> Chain end, - crypto:hash(sha256, Data). + Data. + +entryhash_from_entry(Entry) -> + crypto:hash(sha256, chain_from_entry(Entry)). %% Private functions. -spec unpack_entry(binary()) -> {binary(), binary()}. |