From 1aa959b65818ca98855d7af1ba610528cc82fc25 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sat, 26 Sep 2015 21:14:38 +0200 Subject: Base64-decode submitted blobs and treat them as leaf certs. --- src/v1.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/v1.erl') diff --git a/src/v1.erl b/src/v1.erl index eb35ee7..40e93f2 100644 --- a/src/v1.erl +++ b/src/v1.erl @@ -153,6 +153,12 @@ add_blob(Input) -> {error, E} -> err400("add-blob: bad input:", E); {struct, [{<<"blob">>, Blob}]} -> - success(catlfish:add_chain(Blob, normal)); - _ -> err400("add-blob: missing input: blob", Input) + case (catch base64:decode(Blob)) of + {'EXIT', _} -> + err400("add-blob: invalid base64-encoded blob", Blob); + DecodedBlob -> + success(catlfish:add_chain(DecodedBlob, [], normal)) + end; + _ -> + err400("add-blob: missing input: blob", Input) end. -- cgit v1.1