From 2f0d0c63e2a935835779347b97ce79925347949b 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 d89b521..3c5e6b4 100644 --- a/src/v1.erl +++ b/src/v1.erl @@ -151,6 +151,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