diff options
author | Magnus Ahltorp <map@kth.se> | 2015-08-17 17:46:46 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-08-17 18:09:59 +0200 |
commit | fd33d62b9e8849a3cca344994183f4fe9fa54d81 (patch) | |
tree | 0a87310ea664d68745414bbe23f9589d7c633491 /src/catlfish.erl | |
parent | 6904422f3e8ca95ece5a309ef121a6cd6159e0a8 (diff) |
Wrap entries in plop wrapperplopstoragefix
Diffstat (limited to 'src/catlfish.erl')
-rw-r--r-- | src/catlfish.erl | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/catlfish.erl b/src/catlfish.erl index d483249..053743c 100644 --- a/src/catlfish.erl +++ b/src/catlfish.erl @@ -281,27 +281,26 @@ entryhash_from_entry(PackedEntry) -> %% Private functions. -spec pack_entry(normal|precert, binary(), binary(), [binary()]) -> binary(). pack_entry(Type, MTLText, EndEntityCert, CertChain) -> - list_to_binary( - [tlv:encode(<<"MTL1">>, MTLText), - tlv:encode(case Type of - normal -> <<"EEC1">>; - precert -> <<"PRC1">> - end, EndEntityCert), - tlv:encode(<<"CHN1">>, - list_to_binary( - [tlv:encode(<<"X509">>, E) || E <- CertChain]))]). + [{<<"MTL1">>, MTLText}, + {case Type of + normal -> <<"EEC1">>; + precert -> <<"PRC1">> + end, EndEntityCert}, + {<<"CHN1">>, + list_to_binary( + [tlv:encode(<<"X509">>, E) || E <- CertChain])}]. -spec unpack_entry(binary()) -> {normal|precert, binary(), binary(), [binary()]}. unpack_entry(Entry) -> - {<<"MTL1">>, MTLText, Rest1} = tlv:decode(Entry), - {EECType, EndEntityCert, Rest2} = tlv:decode(Rest1), + [{<<"MTL1">>, MTLText}|Rest1] = Entry, + [{EECType, EndEntityCert}|Rest2] = Rest1, Type = case EECType of <<"EEC1">> -> normal; <<"PRC1">> -> precert end, - {<<"CHN1">>, PackedChain, _Rest3} = tlv:decode(Rest2), % Ignore rest. + [{<<"CHN1">>, PackedChain}|_Rest3] = Rest2, Chain = unpack_certchain(PackedChain), {Type, MTLText, EndEntityCert, Chain}. |