diff options
author | Linus Nordberg <linus@nordu.net> | 2015-09-26 21:14:38 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2015-09-26 21:23:03 +0200 |
commit | 8aa6bdd6da5576ec0329feed282441dfdc6d9fb1 (patch) | |
tree | 0adaf5f89a1e2b9e32affe417ee2baeb9247ef9e /src/v1.erl | |
parent | eabf3612c5efe3b344366802db9f4de36871bacf (diff) |
Base64-decode submitted blobs and treat them as leaf certs.
Diffstat (limited to 'src/v1.erl')
-rw-r--r-- | src/v1.erl | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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. |